Freelist
After corrupt him and the block using the fixing dbms_repair package must be created freelists? As in sybex, Freelist OCP preperation book blocks can become inaccessible due to physical corruption. You must use the REBUILD_FREELISTS procedure to create the list of reconstruction.But I have'nt has encountered no problem to insert the record in the table after the setting of the block without rebuliding freelist, when the above question may encounter if I rebuild not freelist?
SQL> conn test/test123
Connected.
SQL> select count(*) from emp;
COUNT(*)
----------
10000
--Connect to sys
begin
dbms_repair.admin_tables
(table_name => 'REPAIR_TABLE',
table_type => dbms_repair.REPAIR_TABLE,
action => dbms_repair.create_action,
tablespace => 'TEST_CORRUPT');
end;
/
set serveroutput on size 100000;
declare
rpr_count int;
begin
rpr_count := 0;
dbms_repair.check_object(schema_name => 'TEST',object_name => 'EMP',REPAIR_TABLE_name => 'REPAIR_TABLE',corrupt_count => rpr_count);
dbms_output.put_line('repair block count: '||to_char(rpr_count));
end;
/
select object_name, block_id, corrupt_type, marked_corrupt
from REPAIR_TABLE
/
declare
fix_block_count int;
begin
fix_block_count := 0;
dbms_repair.fix_corrupt_blocks (schema_name => 'TEST',object_name => 'EMP',object_type => dbms_repair.table_object,REPAIR_TABLE_name => 'REPAIR_TABLE',fix_count => fix_block_count);
dbms_output.put_line('fix blocks count: ' ||to_char(fix_block_count));
end;
/
select object_name, block_id, marked_corrupt
from REPAIR_TABLE
/
select count(*) from emp
/
-- Skips the corrupt blocks in the tables.
declare
begin
dbms_repair.skip_corrupt_blocks (schema_name => 'TEST',object_name => 'EMP',object_type => dbms_repair.table_object,flags => dbms_repair.skip_flag);
end;
/
select table_name, skip_corrupt from dba_tables
where table_name = 'EMP' and owner='TEST'
/
SQL> conn test/test123
Connected.
SQL> select count(*) from emp;
COUNT(*)
----------
9340
SQL> insert into emp select rownum from all_objects
2 /
40762 rows created.
SQL> commit
2 /
Commit complete.
SQL> select count(*) from emp;
COUNT(*)
----------
50102
Aman... wrote:
I'm not sure that I have read anywhere or have seen me this free list is corrupted after you use the package. And you can see on your own demo he didn't need advertising. So I would say that you have not really do as a confirmed declaration. Also use RMAN to perform block recovery.
I haven't tested this - but if a block is on a freelist and corrupted then what will happen when you tried to find a block for insertion and your session chosen block corrupted free list? Although we can mark tables as 'skip corrupted' maybe that applies only when you tablescans. Just as we have a "fix index" procedure to run having satisfied damaged table blocks, perhaps we must 'fix freelists' to make sure that none of the freelists points to a block that is now marker for ORA-01578.
Another possibility is that this procedure recreates freelists and freelist blocks if corruption is in the freelists - by analogy, there is a procedure (in the dbms_space package I think) to recreate the bitmaps of space segment if they beomce incompatible.
Concerning
Jonathan Lewis
Tags: Database
Similar Questions
-
FREELISTS and FREELIST GROUPS of CREATE TABLE
My oracle 10g, create table statement is below:
CREATE TABLE S005. Test
(
AAA char (1)
)
PCTFREE 0
STORAGE)
FREELISTS 10
FREELIST GROUPS 20
)
LOGGING
NOCACHE
NOPARALLEL
NOMONITORING;
After performing this sql, I have a query table USER_TABLES but FREELISTS and FREELIST_GROUPS fields show nothing.
In my view, FREELISTS value must be 10, and FREELIST_GROUPS should be 20. How to retrieve these values?
Thank you very much
-
Hello
If t1 and t2 are waiting for a freelist become free and t1 began waiting 1, t1 will have access to it first?
Thank youOK, well, because I think that any answer to this question leads to a lot more questions, I'll recommend you read book excellent in Stephan Haisley, available on MetaLink, sorry available on MOS, as Doc ID 157250.1. (Assuming that you can get into MOS and make it work!)
Then keep in mind, the free list management is endangered of the door. With SAMS, free lists are no longer used to manage the blocks with free space. In the long term, it may be more practical to spend the time to understand how the SAMS.
Hope that helps,
-Mark
-
Jin
I read the following white paper:
http://BBS.wisky.org/doc/internal.docs/freelist%20Management%20with%20Oracle%208i%20.PDF
Here, he says:
"All types of freelists are implemented as a simple linked list using a mechanism of last-in first-out.
Now assume that we just a free list of Master and no process lists for free (and I guess if we have no free lists of process, can we have free Transaction lists?). That master free points list data block 5 and 5 points to the data block 7 data block, then the main free list will point to the data block 7 (because it points also to the tail). Now let assume us a new data block, the 100 block of data, becomes available. This block of data 7 now pointing to it, like the master list of free in the segment header. Now let say us that we had to do a lot of inserts. This means that a transaction will go to the MFL, look at the tail, go to the data block 100 and start making inserts so that it is the first to leave the free list? If so, what is the logic behind this? is it because this block of data is "hotter" than the others and is more likely to be in the database buffer cache? or is there a different reason (s)?
Thank you
-
How does Oracle 'choose' a block of free data of freelist?
Hello
We could have 10 blocks on the freelist, all empty. How Oracle will begin to be inserted in these? Will it be by choosing one, he fills, before moving on to the next, or is this a case of many blocks being inserted at the same time?
Thank youThis document gives a reasonable explanation.
http://www.Ixora.com.au/q+a/DataBlock.htm
-
Error on blue screen Windows 7 x 86
Hello, I had a lot of problems with my laptop. The technical support guy said that my HD was done, so he sold me a new one, with Windows 7 x 86 (before I had the x 64), and my cell phone was OK for a while.
During this time, I had some blue screen errors. But after the new HD, it never happened again.
Unfortunately, this week it happened once more. I have the file Minidump here: https://onedrive.live.com/embed?cid=71AB5696D74B2AD5&resid=71AB5696D74B2AD5%21828&authkey=AEmmwpsHL2INHV
and here: https://mega.co.nz/#! sV4QBQDJ! H9gnSuJZBXtv9EvcSFD8eSS0eHybE1_BfqD7l5BjBOo
What is the problem? How can I solve it?
Please, help me.
Thanks in advance.
Hello and good morning (morning here in New York!) :)
BAD_POOL_HEADER (19)
This indicates that a pool header is corrupt.
Error checking 19, {3, 957f5490, 0, 957f5490}
0: kd > k
ChildEBP RetAddr
80f68798 988cb868 nt! ExAllocatePoolWithTag + 0 x 664
80f687ac 988d9e73 win32k! Win32AllocPool + 0 x 13
80f687c0 988d9e27 win32k! AllocThreadBufferWithTag + 0x1e
80f687d0 988da101 win32k! AllocFreeTmpBuffer + 0x2d
80f687f0 988dacfa win32k! ESTROBJ::vInit + 0xcb
80f68b38 9884af67 win32k! GreExtTextOutWLocked + 0x62f
80f68bb4 988afb07 win32k! GreBatchTextOut + 0x1e6
80f68d24 8304a73c win32k! NtGdiFlushUserBatch + 0 x 123
80f68d34 77a164f4 nt! KiFastCallEntry + 0xcc
WARNING: Frame IP not in any known module. Sequence of images may be wrong.
80f68d38 badb0d00 0x77a164f4
80f68d3c 0024ead8 0xbadb0d00
80f68d40 0x24ead8 00000000It seems that the pool freelist is corrupted (caused by a driver left 3rd, probably).
---------------------------------
1. remove and replace avast! with Microsoft Security Essentials for purposes of troubleshooting temporary as it is likely to cause conflicts:
avast! removal - http://www.avast.com/uninstall-utility
MSE - http://Windows.Microsoft.com/en-us/Windows/Security-Essentials-download
2 in your list of drivers loaded, dtsoftbus01.sys figure who is the driver for Daemon Tools. Daemon Tools is a very popular cause of BSOD in 7/8 base systems. Please uninstall Daemon Tools. Alternative imaging programs are: MagicISO, Power ISO, etc.
Kind regards
Patrick
-
Hello
I'm trying to import a table from a database server Oracle 11 GR 2 (11.2.0.3) to a 12cR1 (12.1.0.2) Oracle database (non - CBD).
Here's how I did the export of the source:
SQL > show the db_name parameter
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
db_name string ZEUS
SQL > select banner version of v$.
BANNER
--------------------------------------------------------------------------------
Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE Production 11.2.0.3.0
AMT for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
parfile: exp_missing_SPATIAL_SCHEMAS_ZEUS11g.par
tables is MANGO. ORTHO_PHOTOS, MVDEMO_NATURALEARTH. WORLD_RASTER
Directory = DATA_PUMP_DIR
REUSE_DUMPFILES = y
exclude = statistics
dumpfile = expdp_missing_SPATIAL_SCHEMAS_ZEUS11g.dmp
logfile = logexpdp_missing_SPATIAL_SCHEMAS_ZEUS11g.log
expdp system parfile = exp_missing_SPATIAL_SCHEMAS_ZEUS11g.par
Here's how I did the import to the target:
SQL > show the db_name parameter
VALUE OF TYPE NAME
------------------------------------ ----------- ------------------------------
db_name string ZEUS
SQL > select banner version of v$.
BANNER
--------------------------------------------------------------------------------
Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production
PL/SQL Release 12.1.0.2.0 - Production
CORE Production 12.1.0.2.0
AMT for Linux: Version 12.1.0.2.0 - Production
NLSRTL Version 12.1.0.2.0 - Production
parfile: imp_missing_SPATIAL_SCHEMAS_ZEUS12c.par
tables is MANGO. ORTHO_PHOTOS, MVDEMO_NATURALEARTH. WORLD_RASTER
Directory = TEMP_DUMPS
dumpfile = expdp_missing_SPATIAL_SCHEMAS_ZEUS11g.dmp
logfile = logimpdp_missing_SPATIAL_SCHEMAS_ZEUS12c.log
Impdp system parfile = imp_missing_SPATIAL_SCHEMAS_ZEUS12c.par
I find myself with this kind of error:
ORA-39117: Type necessary to create the table is not included in this operation. Because sql is:
CREATE TABLE "MANGO". "" ORTHO_PHOTOS "(NUMBER OF 'FID', 'NAME"VARCHAR2 (256 BYTE), VARCHAR2 (256 BYTE) 'TYPE', 'IMAGE' "MDSYS"." SDO_GEORASTER')
SEGMENT OF PCTFREE, PCTUSED 10 40 INITRANS, MAXTRANS 1 255 NOCOMPRESS LOGGING CREATION
STORAGE (INITIAL 65536 THEN 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS USER_TABLES DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT 1)
TABLESPACE...
Yet, the 'MDSYS. "' Data SDO_GEORASTER type" exist in the source and target database.
Someone has such experience, may be related to a bug?
Thanks in advance for any information.
Kind regards
Hi Laury.
You say that the object exists, but you check its executable?
https://docs.Oracle.com/database/121/GEORS/release_changes.htm#GEORS1382
I guess that with the release of 12 c, Oracle wish you to specifically take action showing that you have a license Oracle Spatial. Otherwise you can not use the georaster with just the license locator object.
See you soon,.
Paul
-
What is the syntax to create segments?
Hello
segment can be created manually as table space? If Yes, what is the syntax to create the segment?
Concerning
The create table statement has a storage clause that is part of the clause of physical attributes.
These clauses to define options for the creation of segment/measure. If you do not specify the storage clause, then the tablespace-level settings are used.
Documentation of the CREATE TABLE statement
Physical properties: https://docs.oracle.com/database/121/SQLRF/statements_7002.htm#i2126711
{[deferred_segment_creation] [table_compression] segment_attributes_clause}
[inmemory_table_clause] [ilm_clause]
| [deferred_segment_creation] ORGANIZATION
{Heap_org_table_clause BUNCH [segment_attributes_clause]
| INDEX index_org_table_clause [segment_attributes_clause]
| External_table_clause EXTERNAL
}
| CLUSTER cluster (column [, column]...)
Segment attributes clause: https://docs.oracle.com/database/121/SQLRF/statements_7002.htm#i2214991
{physical_attributes_clause
| TABLESPACE tablespace
| logging_clause
}...
{Clause of their physical characteristics: https://docs.oracle.com/database/121/SQLRF/clauses007.htm#SQLRF30011}
[{ PCTFREE whole
| Whole PCTUSED
| INITRANS whole
| storage_clause
}...
]
Term of storage: https://docs.oracle.com/database/121/SQLRF/clauses009.htm#CJACEJGB
STORAGE
({ INITIAL size_clause
| Size_clause NEXT
| MINEXTENTS whole
| MAXEXTENTS {integer |} UNLIMITED }
| maxsize_clause
| PCTINCREASE whole
| Whole FREELISTS
| FREELIST GROUPS around
| OPTIMAL [size_clause |] NULL ]
| USER_TABLES { KEEP |} RECYCLE | DEFAULT }
| FLASH_CACHE { KEEP |} NO | DEFAULT }
| ENCRYPT
} ...
)
However, the create table statement lets you not create segments or extensions directly. New extensions are to be created initially (when the table is created) or later, when more space is needed for the table, usually after several insertions that filled the original measure.
Also remember that SQL is a language of generation 4. But there is no need to go into details such as the management of use or storage. All that and managed by the RDBMS.
-
IMP-00017: statement failed with error ORACLE 1658:
# imp system/pass fromuser = touser = file=/disk1/Downloads/dmp/MI61015.dmp databaseName databaseName
Import: Release 11.2.0.2.0 - Production on Sat Oct 10 09:29:32 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11 g Express Edition Release 11.2.0.2.0 - 64 bit Production
Export file created by EXPORT: V11.02.00 by conventional means
import performed AL32UTF8 and AL16UTF16 NCHAR character set
Customer export uses the (possible character set conversion) US7ASCII character set
. imported objects from databaseName databaseName
. . import of table 'ACCOUNTS' 12 rows imported
. . table import 'AGREEMENTS' 6 imported lines
. . importing table "ASSIGNEDDEPT" 0 rows imported
. . import of 2713 lines imported from the table 'BULKSAVEDCVS '.
. . import of table "CERTIFICATION" 7 lines imported
. . importing table "COMMONDOCS" 0 rows imported
. . table import 'COUNTRY' 256 imported lines
. . importing table "CVCATEGORIES" 6 imported lines
. . table 'CVCERTIFICATION' import 92 lines imported
. . importing table "CVCHECKAGAIN" 56 imported lines
. . importing table "CVDETAILS".
IMP-00058: ORACLE error 1653
ORA-01653: unable to extend table databaseName.CVDETAILS 8192 in the SYSTEM tablespace
IMP-00028: partial import of the restored previous table: 20960 restored lines
. . table 'CVLICENSE' import 756 lines imported
. . importing table "CVPROPERTIES" 69752 imported lines
. . rows in table 'CVSPECIALTY' import imported 6159
. . import of 1701 lines imported from the table 'CVVIEWS '.
. . "DEPT" table import 2 lines imported
IMP-00017: statement failed with error ORACLE 1658:
' CREATE TABLE 'DETAILRESUME' ("D_ID" (14: 0), THE NUMBER OF 'CV_ID' (14: 0), "").
"NUMBER OF 'CAT_ID' (14: 0), 'DETAILRESUME' CLOB) INITRANS PCTUSED 40 PCTFREE 10.
1 MAXTRANS 255' STORAGE ' (INITIALS 67108864 THEN 1048576 MINEXTENTS 1 FREELIST).
"S 1 FREELIST GROUPS 1 DEFAULT USER_TABLES) TABLESPACE 'SYSTEM' LOGGING NOCO.
"COMPRESS LOB ("DETAILRESUME") AS STORE BASICFILE (TABLESPACE 'SYSTEM' ENABLE '.
"CHUNK 8192 PCTVERSION 10 NOCACHE LOGGING STORAGE (INITIAL 6" ONLINE STORAGE ".
"THE NEXT 5536 1048576 MINEXTENTS 1 FREELISTS 1 FREELIST GROUPS 1 USER_TABLES OF."
"FAULT)).
IMP-00003: ORACLE error 1658
ORA-01658: unable to create the INITIAL extent for segment in tablespace SYSTEM
. . importing table "DOCCATEGORIES" 0 rows imported
. . table 'EMPLOYERORAGENT' import 62 lines imported
. . table 'FAQ' import 4 lines imported
. . importing table "FOLDERCVS" 6 imported lines
. . table import 'FOLDERS' 3 imported lines
. . "JOBDETAILS" table import 84 lines imported
. . table 'JOBKEYWORDS' import 190 lines imported
. . table 'JOBPOSTINGS' import 84 lines imported
. . import of table 'JOBPROPERTIES' 89 imported lines
. . table 'JOBRESPONSES' import 64019 lines imported
. . table import "LICENSE" 20 imported lines
. . import of table 'MESSAGES' 0 rows imported
. . table import 'NEWS' 0 rows imported
. . table import "SPECIALTY" 301 lines imported
. . table import "STAFF" 12 rows imported
. . table import 'TICKET' 0 rows imported
. . importing table "TICKETCATEGORY" 0 rows imported
. . importing table "TICKETTEMPLATES" 0 rows imported
. . import of rows in table 'USERS' 4410 imported
About to activate the constraints...
Import completed successfully with warnings.
#
Please advise.
Thank you in anticipation
Christy H. wrote:
How can I increase its space?
That drive you some people to knowledge, but you can't make them think.
-
SNA/ora_rowscn issues
Hi all
I was reading AskTom and he talked about the clothing of the SNA at some point. If this is the case, then how great the RCS measure up until it wraps? Where is stored the film count?
On imports, ora_rowscn on the data in the table will get SNA SNA DB and not what has been exported?
The only use of the CPN in a datapump file would be used for flashback_scn? Right?
Thanks for all replies.
All, Woody would have already seen this, but Tim Gorman posted an answer to this same question on Oracle-L, which explains the operation of the base of SNA and rap as well as some interesting facts
https://www.freelists.org/post/Oracle-l/SCNora-rowscn-questions, 2
- -
HTH - Mark D Powell.
-
Analyze seems to work better stats of DBMS
I know this question has been asked thousands of times in different contexts, but this is a very confusing topic:
I have done a lot of googling and analyzed through the docs, but still not found the answer. Recommendation Docs oracle since version 9:
Oracle Corporation strongly recommends that you use the
DBMS_STATS
package rather thanANALYZE
to collect optimizer statistics. This package allows you to collect statistics in parallel, collect global statistics for partitioned objects, and refine your collection of statistics by other means. In addition, possibly cost-based optimizer uses only statistics that have been collected byDBMS_STATS
. For more information about this package, see Oracle9i supplied PL/SQL Packages and Types reference .However, you must use the
ANALYZE
instruction rather thanDBMS_STATS
for the collection of statistics that are unrelated to the optimizer based on costs, such as:- Use the
VALIDATE
orLIST CHAINED ROWS
clauses - To collect information on the blocks not freelist
I'll try to post a test in most case this post earlier, because I can't post the plans exec real reason policies internal, but here's what I've noticed so far:
Oracle 11.2.0.1.0 - Windows Server 2012 R2 64 bit
-Memory settings increased Oracle, enabled WMA and restart of the database;
-'Place' system statistics collected (dbms_stats.gather_system_stats), to let the Oracle knows that he has to work now;
-Statistical collected schema (dbms_stats.gather_schema_stats);
At this point, always kept users have reported performance issues. By examining some queries concerned, I found that there was a lot of full table scan (but yes, all the indexes were available and stats must be updated after stats diagram, please correct me if I'm wrong). So I ran dbms_stats.delete_schema_stats to remember his stats manually in analyse (cannot remember the paper at the moment, but I read, it is not a good idea to mix his stats with DBMS and analyze simultaneously), after after analysis completed, the cost overall reported 125 (before it was 400), but still a few tables running full table scan , so I remove the statistics for a specific table involved in full table scan, we'll call it 'A' and execution plan now opted for table access by index rowid and the cost for this stage went from 30 to 5, but know the overall cost has increased from-800 to 2000...
So my main questions are:
Anyone who works in a specific environment / db analyze where only worked / benefit show?
Can it be dictated by modeling data / design? Whether or not DBMS / analyze will be a better option?
What other steps can I take to isolate the problem?
Is it necessary to clear the shared pool before collecting statistics, as it is sometimes possible to see immediate change to explain the release of the plan?
Suggestions / corrections will be appreciated.
Thank you.
Guilherme, simply upgrade you your database? I ask because the performance doesn't just normally in all areas except a major problem happens. You get answers better when the full story is presented. The main reason I ask is when you move a version of Oracle to an another treating CBO many changes come into play as with 10g on default DBMS_STATS to collect histograms while 9.2 no histograms were collected by default. The sudden addition of histograms in the equation has burned more than a shop, while others barely noticed.
- -
Back on Oracle 9.2 we had better results using ANALYZE instead of DBMS_STATS. However, we started to use DBMS_STATS with our upgrade to 10.2. We had only to give some queries immediately after the upgrade.
- -
If you recently upgraded you should be re-assembled all the statistics of objects as part of the upgrade. Check your current settings of DBMS_STATS. I recommend that you start with the default values of Oracle in all areas and keep the default values. If you have any items where your plans get bad, you can change the settings on a basis of object level which is a nice feature because if you want to disable the histograms on a specific object or change the number of buckets used with the object.
- -
If this database has been used some time and performance went all of a sudden jar and then using ANALYZE instead of DBMS_STATS is not the right solution. In this case, identify any changes to the system that were made as the parameters of database changes, the new application features enabled, etc...
- -
HTH - Mark D Powell.
- Use the
-
DBMS_DATAPUMP.metadata_remap - a matter of REMAP_TABLE.
I want to export SCOTT. DEPT table and imports than HR. DEPT_HR with constraint. I'm using DBMS_METADATA. METADATA_REMAP with REMAP_SCHEMA (to change the schema anme) and REMAP_TABLE (to change the name of the table). I don't know where I am getting the error. It seems that REMAP_SCHEMA is changing all the names of schema successfully, but REMAP_TABLE does not change the name of the table on the constraint. So constraint is not be created. Is there another workaround solution? Here is a small proof of concept:
SQL> --My database version. SQL> ---------------------- SQL> SELECT * FROM v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for Linux: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production SQL> SET SERVEROUT ON SQL> ed Wrote file afiedt.buf 1 DECLARE 2 l_data_pump_handle NUMBER; 3 l_logfilename VARCHAR2(30) := 'DWABI_'||to_char(sysdate, 'DDMMRRRRhh24miss') || '.log'; 4 l_expfilename VARCHAR2(30) := 'DWABI_'||to_char(sysdate, 'DDMMRRRRhh24miss') || '.dmp'; 5 BEGIN 6 l_data_pump_handle:= DBMS_DATAPUMP.OPEN(operation => 'EXPORT', 7 job_mode => 'TABLE', 8 remote_link => NULL, 9 job_name => 'TEST_REMAP_DP', 10 version => 'LATEST'); 11 DBMS_DATAPUMP.ADD_FILE(handle => l_data_pump_handle, 12 filename => l_expfilename, 13 directory => 'SAUBHIK', 14 filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE); 15 DBMS_DATAPUMP.ADD_FILE(handle => l_data_pump_handle, 16 filename => l_logfilename, 17 directory => 'SAUBHIK', 18 filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE); 19 DBMS_DATAPUMP.metadata_filter(handle => l_data_pump_handle, 20 name => 'SCHEMA_EXPR', 21 value =>'= '||''''||'SCOTT'||''''); 22 DBMS_DATAPUMP.metadata_filter(handle => l_data_pump_handle, 23 name => 'NAME_EXPR', 24 value =>'= '||''''||'DEPT'||''''); 25 --We don't need index 26 DBMS_DATAPUMP.metadata_filter(handle => l_data_pump_handle, 27 name => 'EXCLUDE_PATH_EXPR', 28 value =>'=''INDEX'''); 29 -- We don't copy table statistics!! 30 DBMS_DATAPUMP.metadata_filter(handle => l_data_pump_handle, 31 name => 'EXCLUDE_PATH_EXPR', 32 value =>'=''STATISTICS'''); 33 -- We don't copy index statistics either!! 34 DBMS_DATAPUMP.metadata_filter(handle => l_data_pump_handle, 35 name => 'EXCLUDE_PATH_EXPR', 36 value =>'=''INDEX_STATISTICS'''); 37 -- We do not need the data!! 38 DBMS_DATAPUMP.DATA_FILTER( 39 handle => l_data_pump_handle, 40 name => 'INCLUDE_ROWS', 41 value =>0 42 ); 43 -- Start the export now. 44 DBMS_DATAPUMP.start_job(l_data_pump_handle); 45 dbms_output.put_line('Export started....'); 46 -- Detach, it's finish! 47 DBMS_DATAPUMP.detach(l_data_pump_handle); 48 dbms_output.put_line('Export ended....'); 49 EXCEPTION 50 WHEN OTHERS THEN 51 dbms_datapump.stop_job(l_data_pump_handle); 52 RAISE; 53* END; 54 / Export started.... Export ended.... PL/SQL procedure successfully completed. SQL> SELECT * FROM user_datapump_jobs; no rows selected
Now, I'm importing that:
SQL> ed Wrote file afiedt.buf 1 --DWABI_28052015143133.dmp 2 DECLARE 3 l_data_pump_imp_handle NUMBER; 4 l_logfilename VARCHAR2(30) := 'DWABI_'||to_char(sysdate, 'DDMMRRRRhh24miss') || '.log'; 5 ind NUMBER; -- loop index 6 pct_done NUMBER; -- percentage complete 7 job_state VARCHAR2(30); -- track job state 8 le ku$_LogEntry; -- WIP and error messages 9 js ku$_JobStatus; -- job status from get_status 10 jd ku$_JobDesc; -- job description from get_status 11 sts ku$_Status; -- status object returned by get_status 12 BEGIN 13 l_data_pump_imp_handle:= DBMS_DATAPUMP.OPEN(operation => 'IMPORT', 14 job_mode => 'FULL', 15 remote_link => NULL, 16 job_name => 'TEST', 17 version => 'LATEST'); 18 DBMS_DATAPUMP.ADD_FILE(handle => l_data_pump_imp_handle, 19 filename => 'DWABI_28052015143133.dmp', 20 directory => 'SAUBHIK', 21 filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_DUMP_FILE); 22 DBMS_DATAPUMP.ADD_FILE(handle => l_data_pump_imp_handle, 23 filename => l_logfilename, 24 directory => 'SAUBHIK', 25 filetype => DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE); 26 --If table is already there then do not import. 27 dbms_datapump.set_parameter(handle => l_data_pump_imp_handle, 28 name => 'TABLE_EXISTS_ACTION', 29 value =>'SKIP'); 30 -- We need to remap the schema!!. 31 dbms_output.put_line('Changing Schema...'); 32 DBMS_DATAPUMP.METADATA_REMAP ( 33 handle => l_data_pump_imp_handle, 34 name => 'REMAP_SCHEMA', 35 old_value => 'SCOTT', 36 value=>'HR' 37 ); 38 -- We need to remap the table!!. This is not working properly. 39 dbms_output.put_line('Changing Table...'); 40 DBMS_DATAPUMP.METADATA_REMAP ( 41 handle => l_data_pump_imp_handle, 42 name => 'REMAP_TABLE', 43 old_value => 'DEPT', 44 value=>'DEPT_HR', 45 object_type => NULL 46 ); 47 -- Start the import now. 48 DBMS_DATAPUMP.start_job(l_data_pump_imp_handle); 49 -- monitor job 50 pct_done := 0; 51 job_state := 'UNDEFINED'; 52 WHILE (job_state != 'COMPLETED') AND (job_state != 'STOPPED') LOOP 53 dbms_datapump.get_status(l_data_pump_imp_handle, dbms_datapump.ku$_status_job_error + 54 dbms_datapump.ku$_status_job_status + 55 dbms_datapump.ku$_status_wip, -1, job_state, sts); 56 js := sts.job_status; 57 -- If the percentage done changed, display the new value 58 IF js.percent_done != pct_done THEN 59 dbms_output.put_line('*** Job percent done = ' || 60 to_char(js.percent_done)); 61 pct_done := js.percent_done; 62 END IF; 63 -- If any work-in-progress (WIP) or error messages 64 -- were received for the job, display them. 65 IF (BITAND(sts.mask,dbms_datapump.ku$_status_wip) != 0) THEN 66 le := sts.wip; 67 ELSE 68 IF (BITAND(sts.mask,dbms_datapump.ku$_status_job_error) != 0) THEN 69 le := sts.error; 70 ELSE 71 le := NULL; 72 END IF; 73 END IF; 74 IF le IS NOT NULL THEN 75 ind := le.FIRST; 76 WHILE ind IS NOT NULL LOOP 77 dbms_output.put_line(le(ind).LogText); 78 ind := le.NEXT(ind); 79 END LOOP; 80 END IF; 81 --DBMS_LOCK.sleep (10); 82 END LOOP; 83 -- Indicate that the job finished and detach from it. 84 dbms_output.put_line('Job has completed'); 85 -- Detach, it's finish! 86 DBMS_DATAPUMP.detach(l_data_pump_imp_handle); 87 EXCEPTION 88 WHEN OTHERS THEN 89 dbms_datapump.stop_job(l_data_pump_imp_handle); 90 RAISE; 91* END; SQL> / Changing Schema... Changing Table... Master table "SYS"."TEST" successfully loaded/unloaded Starting "SYS"."TEST": Processing object type TABLE_EXPORT/TABLE/TABLE Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT ORA-39083: Object type CONSTRAINT failed to create with error: ORA-00942: table or view does not exist Failing sql is: ALTER TABLE "HR"."DEPT" ADD CONSTRAINT "PK_DEPT" PRIMARY KEY ("DEPTNO") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "USERS" ENABLE Job "SYS"."TEST" completed with 1 error(s) at 15:04:02 Job has completed PL/SQL procedure successfully completed. SQL>
If you look at the failing sql code, it is clear that the name of the table in the constraint definition has not changed, but the DEPT_HR table is created in the HR schema without constraint. What's not here?
Post edited by: Massimiliano edited the subject line, because he said as DBMS_METADATA. Changed to DBMS_DATAPUMP.
Hello
This is a bug in 11.2.0.1 I think - please this Ref
Oracle Support Document 1609238.1 (REMAP_TABLE on IMPDP FAILS WITH ORA-942) can be found at: https://support.oracle.com/epmos/faces/DocumentDisplay?id=1609238.1
See you soon,.
Rich
-
Hello
I have developed 1 application where in i Ran SQL advisor tunning to grant some queries and it created many clues.
So now I have to rename these indexes (LOB) to something like table_name_column name so I need to get the metadata in order to check the columns these lob indexes are cerated
But when I ran get ddl statement I do not get the names of columns on which these lob indexes are created.
Example:
SQL > select dbms_metadata.get_ddl('INDEX','SYS_IL0000113826C00055$$','XXI') from double;
DBMS_METADATA. GET_DDL('INDEX','SYS_IL0000113826C00055$$','XXCEMLI')
--------------------------------------------------------------------------------
CREATE A UNIQUE INDEX "XXI". "" SYS_IL0000113826C00055$ $' TO 'XX '. "" (tbs1_MV).
PCTFREE, INITRANS 10 2 MAXTRANS 255
STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
USER_TABLES FLASH_CACHE, CELL_FLASH_CACHE DEFAULT DEFAULT)
TABLESPACE "XXI_D".
PARALLEL (INSTANCES OF DEGREE 0 0)
DBMS_METADATA. GET_DDL('INDEX','SYS_IL0000113826C00012$$','XXCEMLI')
--------------------------------------------------------------------------------
CREATE A UNIQUE INDEX "XXI". "" SYS_IL0000113826C00012$ $' ON 'XXCEMLI '. "" (tbs1_MV).
PCTFREE, INITRANS 10 2 MAXTRANS 255
STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
USER_TABLES FLASH_CACHE, CELL_FLASH_CACHE DEFAULT DEFAULT)
TABLESPACE "XXI_D".
PARALLEL (INSTANCES OF DEGREE 0 0)
These indices are those that Oracle uses to find the content of the LOB column in the LOB segment when they are stored offline. They are created and managed automatically by Oracle when you create a LOB column. There is no need to change the names for those since you'll never use them, only Oracle internally. In fact, I'm not entirely sure if you can change the name without breaking your BUSINESS.
John
-
Reuse of blocks released upward in partitioned table
Hello world
I have a database creates a new partition and after a certain retention counter old partitions are deleted. This is done every day. We had some problem sometime before, so we disabled the partition drop script until it is revised for the partitions are not deleted for now. But we're going to delete all the files in the old partitions on a daily basis so that later, when we allow rear drop partition script it will not push the system.
Now the problem is though that we delete the lines of the old partitions that continues to increase the size of the storage space, which means that it does not use the freed block. Please correct me if I'm wrong here, to my knowledge when the records in a table is removed the blocks going to the freelist for subsequent data inserts.
The method above does not apply to the partitioned table is? If the space is released only if the partition is deleted? Thank you for you're your time and your answers. Very much appreciated.
Database: Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0
OS: Oracle Solaris 10 SPARC 64 bit
I have a database creates a new partition and after a certain retention counter old partitions are deleted. This is done every day. We had some problem sometime before, so we disabled the partition drop script until it is revised for the partitions are not deleted for now. But we're going to delete all the files in the old partitions on a daily basis so that later, when we allow rear drop partition script it will not push the system.
If possible, you should use TRUNCATE so that high tide is reset. It will be much faster to delete lines.
What PROBLEM you encounter who pushed you to 'disable' the drop?
Now the problem is though that we delete the lines of the old partitions that continues to increase the size of the storage space, which means that it does not use the freed block. Please correct me if I'm wrong here, to my knowledge when the records in a table is removed the blocks going to the freelist for subsequent data inserts.
Correct - but only "freelist" will NOT be used for removable direct-path.
My guess is that your new data every day are INSERTED in BULK. If, then Oracle just formats new blocks and fills them directly and does not use the free list.
Do you use inserts of direct-path for new data?
-
How can I export index partition (DDL)?
How can I export index partition (DDL)?
For example:
PARTITION BY RANGE (ID) INTERVAL (1) ( PARTITION "XXXXX" VALUES LESS THAN (1) SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 0 INITRANS 1 MAXTRANS 255 COMPRESS FOR OLTP NOLOGGING STORAGE(INITIAL 1 NEXT 2 MINEXTENTS 1 MAXEXTENTS 2000 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "XXXXXXXXX" ) ;
Thank you!
How can I export index partition (DDL)?
For example:
- PARTITION BY INTERVAL OF THE RANGE (ID) () (1)
- PARTITION 'XXXXX' LOWER VALUES (1)
- CREATION OF IMMEDIATE SEGMENT
- PCTFREE, PCTUSED 10 0 INITRANS 1 MAXTRANS 255
- COMPRESS FOR OLTP NOLOGGING
- STORAGE (INITIAL 1 2 MINEXTENTS 1 MAXEXTENTS 2000)
- PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
- USER_TABLES FLASH_CACHE, CELL_FLASH_CACHE DEFAULT DEFAULT)
- TABLESPACE 'XXXXXXXXX');
Don't know what you mean... maybe this?
SQL > 100000 long value
SQL > select dbms_metadata.get_ddl ('TABLE',')
','
')
2 double;
Maybe you are looking for
-
I want to put my favorites and contacts on edge too! Out port so I can use both browsers!
I am downloading windows 10 and have so many new things, I want to stay with Firefox but must faves & contacts on both browsers. If you can give me some instructions on how to do it save me a lot of time! It will be fun to use some of the new inventi
-
Can someone advise me as to why there is no TV out on the tecra A2?
-
3 beeps after startup chime then nothing
Hello My iMac intel (2011) was working fine earlier today. Then I came back to find it on the gray screen with the apple logo. I tried to restart it, and it became stuck on the gray screen with three loud beeps, after initial startup Gong. I tried
-
Any way to switch to the onboard graphics on Windows 10 Bootcamp?
Wondered if there was a method to move from an AMD/Nvidia Graphics and graphics card integrated into Windows 10 on the Macbook Pro. I know that some people got to work in Win8.1 but this market on Windows 10? And if yes, how did you do? I hope that p
-
Windows 7 presents Session Active - no user not connected?
OS: Windows 7 Pro x 64 I get this message when I mstsc (RDP) on a remote machine (several machines all have the same problem): "There is an active user connected to this system. Please do not try to connect to this system... » How can I remove this m