Disclaimer All information is offered in good faith and in the hope that it may be of use for educational purpose and for Database community purpose, but is not guaranteed to be correct, up to date or suitable for any particular purpose. db.geeksinsight.com accepts no liability in respect of this information or its use.
This site is independent of and does not represent Oracle Corporation in any way. Oracle does not officially sponsor, approve, or endorse this site or its content and if notify any such I am happy to remove.
Product and company names mentioned in this website may be the trademarks of their respective owners and published here for informational purpose only.
This is my personal blog. The views expressed on these pages are mine and learnt from other blogs and bloggers and to enhance and support the DBA community and this web blog does not represent the thoughts, intentions, plans or strategies of my current employer nor the Oracle and its affiliates or any other companies. And this website does not offer or take profit for providing these content and this is purely non-profit and for educational purpose only.
If you see any issues with Content and copy write issues, I am happy to remove if you notify me.
Contact Geek DBA Team, via geeksinsights@gmail.com
|
From 12c onwards, partitions movement has been extended with "online clause", along with this global index are maintained during partition maintenance , hence manual rebuild of index is not required any more. Before proceeding with the test, here are some restriction as listed in documentation,
ONLINE clause can’t be specified ?for tables owned by SYS.
for index-organized tables.
for heap-organized tables that contain object types or on which bitmap
join indexes or domain indexes are defined.
when database-level supplemental logging is enabled for the database.
Parallel DML and direct path INSERT operations require an exclusive lock on the table.
Therefore, these operations are not supported concurrently with an ongoing
online partition MOVE, due to conflicting locks.
Lets open two sessions to show you the online partition movements along with dml operations on another session
Session 1
=========
SQL> select sys_context('USERENV', 'SID') sid from dual;
SID
------
7
Session 2
=========
SQL> select sys_context('USERENV', 'SID') sid from dual;
SID
------
72
Lets create a table with range partition in session 1,
SQL> create table test_tbl
(
id1 number,
id2 number
)
partition by range(id1)
(
partition p1 values less than(10)
) tablespace users;
Table created.
SQL>
Check the object id for this partition
SQL> select object_name, subobject_name, data_object_id
from user_objects
where object_name='TEST_TBL'
and subobject_name='P1';
OBJECT_NAME SUBOBJECT_NAME DATA_OBJECT_ID
-------------- ------------------ --------------
TEST_TBL P1 91681
Under session 2, insert into partition without commit anything to simulate the DML operation while move partition later
SQL> select sys_context('USERENV', 'SID') sid from dual;
SID
------
72
SQL> insert into test_tbl values(2,2);
1 rows inserted.
Under Session 1, Give the alter partition with online command
SQL> alter table test_tbl move partition p1 ONLINE;
Now your session waits for insert statement to commit above.
Check the locks
SQL> set lines 1000
SQL> SELECT DECODE(request,0,'Holder: ','Waiter: ')||sid sess,
id1, id2, lmode, request, type
FROM V$LOCK
WHERE (id1, id2, type) IN
(SELECT id1, id2, type FROM V$LOCK WHERE request>0)
ORDER BY id1, request ;
2 3 4 5 6
SESS ID1 ID2 LMODE REQUEST TY
------------------------------------------------ ---------- ---------- ---------- ---------- --
Holder: 72 458763 1589 6 0 TX
Waiter: 7 458763 1589 0 4 TX
SQL>
As you see the First session (7) is waiting for second session (72) where the request mode of session 1(7) is 4.
Let's open third session and do some insert operations , this operations
will not affect nor wait and they proceed.
SQL> select sys_context('USERENV', 'SID') sid from dual;
SID
--------------------------------------------------------------------------------
58
SQL> insert into test_tbl values(3,3);
1 row created.
SQL> commit;
Commit complete.
SQL>
Well my first session operation still is going i.e online move operation, i can do the DML concurrently, which does not affect at all Lets commit the first session to proceed with non blocking.
SQL> select sys_context('USERENV', 'SID') sid from dual;
SID
------
72
SQL> commit;
Commit complete.
SQL>
Now in my session 1, the table partition movement has been completed and the object id has also been changed to evident the online movement.
SQL> select object_name, subobject_name, data_object_id
from user_objects
where object_name='TEST_TBL'
and subobject_name='P1'; 2 3 4
OBJECT_NAME SUBOBJECT_NAME DATA_OBJECT_ID
----------------- -------------- --------------
TEST_TBL P1 91682
SQL>
SQL> select * from test_tbl;
ID1 ID2
---------- ----------
3 3
1 1
2 2
SQL>
This feature is extremely helpful when you doing partition level re-org. -Thanks Geek DBA
Prior to 12c, if the developer wants to create a sequential ID number generator , he/she has to use a sequence and then a trigger or reference that seq value in the insert statement.
From 12c Onwards, this has been enhanced by providing the sequence.nextval in the table definition itself.
Further it even enhanced that without sequence you can now generate a sequential number with identity columns, where this kind of feature available in MS-SQL etc.
Let’s see the default value enhancements.
SQL> create sequence t1_seq;
Sequence created.
SQL> create table t1 (id number default t1_seq.nextval, name varchar2(20)) tablespace users;
Table created.
SQL> insert into t1(id,name) values(1,'Geek DBA');
1 row created.
SQL> insert into t1(name) values('Ramesh');
1 row created.
SQL> insert into t1(id,name) values(NULL,'Brijest');
1 row created.
SQL> select * from t1;
ID NAME
---------- --------------------
1 Geek DBA
1 Ramesh
Brijesh
SQL>
As you see there we have inserted the rows with ID, without ID and with NULL and if you observe the output, ID populates
1) For first insert, the statement has been inserted as is
2) For second insert, Used sequence.nextval and inserted 1 in ID column
3) For third insert, as we used NULL for ID, NULL has been inserted.
In addition to above we can use explicitly sequences where NULL has been provided like for second case above. Let test with what happened when nulls added, as I have
a) Created a sequence
b) Add a column to the table and made that column default value to a sequece, note the difference is
default on null (this is new)
c) First insert having all columns and inserted as is
d) Second insert with no sequences appended
e) Third insert wiht null values, as you see the ID1 column is not populated but the ID2
with default on null sequence is populated with value
SQL> truncate table t1;
Table truncated.
SQL> create sequence t1_seq_on_null;
Sequence created.
SQL> alter table t1 add id2 number default on null t1_seq_on_null.nextval;
Table altered.
SQL> insert into t1(id,name,id2) values(1,'Geek DBA',101);
1 row created.
SQL> insert into t1(name) values('Geek DBA');
1 row created.
SQL> insert into t1(id,name,id2) values(null,'Geek DBA',null);
1 row created.
SQL> commit;
Commit complete.
SQL> select * from t1;
ID NAME ID2
---------- -------------------- ----------
1 Geek DBA 101
21 Geek DBA 1
Geek DBA 2
A user has posted me "how to find the fragmentation for a table that contains CLOB", ironically all the queries and other stuff will lead to confusion or no more useful.
Honestly, to answer this question I have searched many things to clear up, only Jonathan has a clear cut demonstration and answer for it. Here is the piece of code,Jonathan has used to demonstrate the purpose.
create table t1(
v1 varchar2(10),
-- l long,
l clob,
v2 varchar2(10)
) tablespace users;
insert into t1 select lpad(rownum,10,'0'), rpad('x',100,'x'), lpad(rownum,10,'0') from all_objects where rownum <= 1000 ;
After collecting the statistics,
SQL> execute dbms_stats.gather_table_stats('TEST','T1');
PL/SQL procedure successfully completed.
SQL> select
blocks, num_rows, avg_row_len, pct_free,
ceil(num_rows * avg_row_len / (8000 * ((100 - pct_free)/100))) blocks_needed
from
user_tables
where
table_name = 'T1'
;
2 3 4 5 6 7 8
BLOCKS NUM_ROWS AVG_ROW_LEN PCT_FREE BLOCKS_NEEDED
---------- ---------- ----------- ---------- -------------
27 1000 225 10 32
Table showing it requires 32 blocks instead of 27 blocks, as per avg row len calculation.
Note:- The dbms_stats includes other stuff like lob locators etc and makes the avg row len higher than it has.
To estimate the correct size or avg row len, you will need to use deprecated "analyze command" to gather statistics on lob columns
SQL> analyze table t1 compute statistics;
Table analyzed.
SQL> select
blocks, num_rows, avg_row_len, pct_free,
ceil(num_rows * avg_row_len / (8000 * ((100 - pct_free)/100))) blocks_needed
from
user_tables
where
table_name = 'T1'
;
2 3 4 5 6 7 8
BLOCKS NUM_ROWS AVG_ROW_LEN PCT_FREE BLOCKS_NEEDED
---------- ---------- ----------- ---------- -------------
27 1000 162 10 23
SQL>
Solution: Use table move or alter table shrink in latest versions
New Background Processes that has been introduced from 12c, compared with 11.2.0.2 Database.
| 12 C |
Process Name |
| AQPC |
AQ Process Coordinator |
| ARSn |
ASM Recovery Slave Process |
| BWnn |
Database Writer Process |
| FENC |
Fence Monitor Process |
| IPC0 |
IPC Service Background Process |
| LDDn |
Global Enqueue Service Daemon Helper Slave |
| LGnn |
Log Writer Worker |
| LREG |
Listener Registration Process |
| NSSn |
Network Server SYNC Process |
| OFSD |
Oracle File Server Background Process |
| QMnn |
AQ Master Class Process |
| RM |
RAT Masking Slave Process |
| RMON |
Rolling Migration Monitor Process |
| RPOP |
Instant Recovery Repopulation Daemon |
| SAnn |
SGA Allocator |
| SCCn |
ASM Disk Scrubbing Slave Check Process |
| SCRB |
ASM Disk Scrubbing Master Process |
| SCRn |
ASM Disk Scrubbing Slave Repair Process |
| SCVn |
ASM Disk Scrubbing Slave Verify Process |
| TTnn |
Redo Transport Slave Process |
| VUBG |
Volume drive Umbilicus Background |
Source:- http://docs.oracle.com/cd/E16655_01/server.121/e17615/bgprocesses.htm
Some of the parameters that names have been changed, for example NSA1 (Redo transport services has been named as TTnn etc)
The following are the parameters are introduced newly in 12c. (Note I have compared them with 11.2.0.1 Database)
Excluded _Parameters
select KSPPINM, KSPPDESC from x$ksppi where con_id=1
minus
select KSPPINM, KSPPDESC from t2@Geek DBA11g
order by 1,2
awr_snapshot_time_offset Setting for AWR Snapshot Time Offset
cell_offloadgroup_name Set the offload group name
clonedb clone database
connection_brokers connection brokers specification
cursor_bind_capture_destination Allowed destination for captured bind variables
db_big_table_cache_percent_target Big table cache target size in percentage
db_index_compression_inheritance options for table or tablespace level compression inheritance
db_unrecoverable_scn_tracking Track nologging SCN in controlfile
dnfs_batch_size Max number of dNFS asynch I/O requests queued per session
enable_pluggable_database Enable Pluggable Database
heat_map ILM Heatmap Tracking
max_string_size controls maximum size of VARCHAR2, NVARCHAR2, and RAW types in SQL
nls_timestamp_tz_format timestamp with timezone format
noncdb_compatible Non-CDB Compatible
optimizer_adaptive_features controls adaptive features
optimizer_adaptive_reporting_only use reporting-only mode for adaptive optimizations
parallel_degree_level adjust the computed degree in percentage
parallel_degree_policy policy used to compute the degree of parallelism (MANUAL/LIMITED/AUTO/ADAPTIVE)
parallel_fault_tolerance_enabled enables or disables fault-tolerance for parallel statement
pdb_file_name_convert PDB file name convert patterns and strings for create cdb/pdb
pga_aggregate_limit limit of aggregate PGA memory consumed by the instance
processor_group_name Name of the processor group that this instance should run in.
spatial_vector_acceleration enable spatial vector acceleration
temp_undo_enabled is temporary undo enabled
threaded_execution Threaded Execution Mode
unified_audit_sga_queue_size Size of Unified audit SGA Queue
use_dedicated_broker Use dedicated connection broker
use_large_pages Use large pages if available (TRUE/FALSE/ONLY)
-Thanks
Geek DBA
Here are the some of enhancements for Import (IMPDP) Disabling Logging for Oracle Data Pump Import
You can now use the DISABLE_ARCHIVE_LOGGING Paramaeter to disable logging for table, index or both during import.
Logging is not completely disable but only a small amount is generated. Also don`t forget that there is a database parameter FORCE LOGGING which overwrites this feature.
Example:
For schema
impdp scott/tiger DIRECTORY=dpump1 DUMPFILE=scott1.dmp schemas=scott TRANSFORM=DISABLE_ARCHIVE_LOGGING:Y
For Index no logging
impdp scott/tiger DIRECTORY=dpump1 DUMPFILE=scott1.dmp schemas=scott TRANSFORM=DISABLE_ARCHIVE_LOGGING:Y:INDEX
For Table no logging but for other objects logging=Y
impdp scott/tiger DIRECTORY=dpump1 DUMPFILE=scott1.dmp schemas=scott
TRANSFORM=DISABLE_ARCHIVE_LOGGING:Y TRANSFORM=DISABLE_ARCHIVE_LOGGING:N:TABLE
Creating SecureFile LOBs During Import You can now specify the LOB Storage during import
example:
impdp scott/tiger DIRECTORY=dpump1 DUMPFILE=export.dmp LOB_STORAGE:SECUREFILE
Compressing Tables During Import You can now specify a Compression method during import
example:
impdp scott/tiger DIRECTORY=dpump1 DUMPFILE=export.dmp TRANSFORM=TABLE_COMPRESSION_CLAUSE:"COMPRESS FOR OLTP"
Can have timestamp printed for every object that is imported (ofcourse export as well)
impdp logtime=all test/test DIRECTORY=dpump1 DUMPFILE=export.dmp schemas=test
Import: Release 12.1.0.1.0 - Production on Tue Sep 15 13:33:16 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
15-Sep-13 13:33:19.192: Starting "TEST"."SYS_IMPORT_SCHEMA_01": test/******** logtime=all directory=test
15-Sep-13 13:33:19.347: Estimate in progress using BLOCKS method...
...
15-Sep-13 13:33:46.884: . . imported "TEST"."A" 0 KB 0 rows
... ...
You can now audit all impdp/expd operations with unified auditing
Example:-
CREATE AUDIT POLICY policy_name ACTIONS COMPONENT=DATAPUMP { EXPORT | IMPORT | ALL };
Keep policy
AUDIT POLICY audit_dp_all_pol BY SYSTEM;
Verify the audit reports
SELECT DP_TEXT_PARAMETERS1, DP_BOOLEAN_PARAMETERS1 FROM UNIFIED_AUDIT_TRAIL
WHERE AUDIT_TYPE = 'DATAPUMP';
DP_TEXT_PARAMETERS1 DP_BOOLEAN_PARAMETERS1
---------------------------------------------- ----------------------------------
MASTER TABLE: "SCOTT"."SYS_EXPORT_TABLE_01", MASTER_ONLY: FALSE,
JOB_TYPE: EXPORT, DATA_ONLY: FALSE,
METADATA_JOB_MODE: TABLE_EXPORT, METADATA_ONLY: FALSE,
JOB VERSION: 12.1.0.0, DUMPFILE_PRESENT: TRUE,
ACCESS METHOD: DIRECT_PATH, JOB_RESTARTED: FALSE
DATA OPTIONS: 0,
DUMPER DIRECTORY: NULL
REMOTE LINK: NULL,
TABLE EXISTS: NULL,
PARTITION OPTIONS: NONE
-Thanks
Geek DBA
Here is the list of enhancements for export datapump.
expdp Specifying the Encryption Password
You can now specify silently a password during runtime. When you import a encrypted Dumpfile
you can pass the Password for that file from the STDIN.
The password will not visible by commands like ps or will not be stored in scripts.
Example:-
expdp scott/tiger DIRECTORY=dpump1 DUMPFILE=export.dmp ENCRYPTION_PWD_PROMPT=Y
Exporting Views as Tables You can now export a View as a table.
Example:-
expdp scott/tiger DIRECTORY=dpump1 DUMPFILE=scott1.dmp VIEWS_AS_TABLES=empview tables=emp
Transportable feature You can now use trasportable feature for FULL/Tablespace/Table:Paritions with export pump
Full Transportable Export/Import (Full Database)
Example:-
1) Make the tablespaces readonly
2) Export the database
expdp user_name full=y dumpfile=expdat.dmp directory=data_pump_dir transportable=always logfile=export.log
3) Check the export log, which files should be copied to target system.
Example:-
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_TRANSPORTABLE_01 is:
/u01/app/oracle/admin/mydb/dpdump/expdat.dmp
******************************************************************************
Datafiles required for transportable tablespace SALES:
/u01/app/oracle/oradata/mydb/sales01.dbf
Datafiles required for transportable tablespace CUSTOMERS:
/u01/app/oracle/oradata/mydb/cust01.dbf
Datafiles required for transportable tablespace EMPLOYEES:
/u01/app/oracle/oradata/mydb/emp01.dbf
4) Check the endian conversion if required
SELECT d.PLATFORM_NAME, ENDIAN_FORMAT
FROM V$TRANSPORTABLE_PLATFORM tp, V$DATABASE d
WHERE tp.PLATFORM_NAME = d.PLATFORM_NAME;
5) Import the database
impdp scott/tiger FULL=y DUMPFILE=fullexp.dmp DIRECTORY=dpump1
TRANSPORT_DATAFILES='/u01/app/oracle/oradata/db1211/users01.dbf' LOGFILE=import.log
Transportable Export/Import (Tablespaces)
1) Check the tablespace self contained or not
EXECUTE DBMS_TTS.TRANSPORT_SET_CHECK('sales_1,sales_2', TRUE);
SELECT * FROM TRANSPORT_SET_VIOLATIONS;
2) Make the tabelspaces read only
ALTER TABLESPACE sales_1 READ ONLY;
ALTER TABLESPACE sales_2 READ ONLY;
3) expdp user_name dumpfile=expdat.dmp directory=data_pump_dir transport_tablespaces=sales_1,sales_2 logfile=tts_export.log
4) Check the logs for the files that are need to copy to target system
Example:-
*****************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_TRANSPORTABLE_01 is:
/u01/app/oracle/admin/salesdb/dpdump/expdat.dmp
*****************************************************************************
Datafiles required for transportable tablespace SALES_1:
/u01/app/oracle/oradata/salesdb/sales_101.dbf
Datafiles required for transportable tablespace SALES_2:
/u01/app/oracle/oradata/salesdb/sales_201.dbf
5) Convert the endian of files in source system if required, mark the tablespace read/write in source
6) Copy those file to target system
7) impdp user_name dumpfile=expdat.dmp directory=data_pump_dir
transport_datafiles=
'c:\app\orauser\oradata\orawin\sales_101.dbf',
'c:\app\orauser\oradata\orawin\sales_201.dbf'
remap_schema=sales1:crm1 remap_schema=sales2:crm2
logfile=tts_import.log
Transportable Export/Import (Tables/Partitions)
1) Mark the datafiles that are associated with table as read only
SQL> ALTER TABLESPACE sales_prt_tbs READ ONLY;
2) Export using expdp, tables
Example:-
expdp user_name dumpfile=sales_prt.dmp directory=data_pump_dir
tables=sh.sales_prt:sales_q1_2000,sh.sales_prt:sales_q2_2000
transportable=always logfile=exp.log
3) Check the log for the datafiles to be copied.
Datafiles required for transportable tablespace SALES_PRT_TBS:
/u01/app/oracle/oradata/sourcedb/sales_prt.dbf
Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at 11:32:13
4) Copy the datafile to target
5) Import the dump
Example:- impdp user_name dumpfile=sales_prt.dmp directory=data_pump_dir
transport_datafiles='/u01/app/oracle/oradata/targetdb/sales_prt.dbf'
tables=sh.sales_prt:sales_q1_2000,sh.sales_prt:sales_q2_2000
logfile=imp.log
Next Post: IMPDP Enhancements
-Thanks
Geek DBA
From 12c Onwards, Oracle has made some important changes to SQLloader and enhanced a lot, one of the feature was express loading with minimal configuration.
You will just need to create a data file with same name as Table name and thats it no control file or other parameters required.
It just default load those data into the table. Further, there are lot more new options for sqlldr, one must see if they are using this tool in their application batch processing.
For example, Multi threading, Degree of Parallelism, DNFS support, external table via DNFS etc. Read More here:- http://docs.oracle.com/cd/E16655_01/server.121/e17906/chapter1.htm
Let's see the express mode feature, Create a sample table
SQL> create table EMPLOYEE (employee_id number primary key, employee_name varchar2(50)) tablespace users;
Table created.
Create the data file to load into table, (Note the file name is also as like as table name, this is must)
SQL> !vi EMPLOYEE.dat
SQL> !cat EMPLOYEE.dat
1,XXXXXXXXXXX
2,YYYYYYYYYYY
3,ZZZZZZZZZZZ
4,CCCCCCCCCCC
5,DDDDDDDDDDD
6,FFFFFFFFFFF
7,GGGGGGGGGGG
8,HHHHHHHHHHH
9,OOOOOOOOOOO
10,JJJJJJJJJJ
Just kick off the sqlldr, As you see I have not created any control file or any commands provided, just a table name to load, this is what minimal configuration is.
[oracle@Geek DBA12c ~]$ sqlldr test/test@pdb12c TABLE=EMPLOYEE
SQL*Loader: Release 12.1.0.1.0 - Production on Mon Sep 16 21:01:11 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
Express Mode Load, Table: EMPLOYEE
Path used: External Table, DEGREE_OF_PARALLELISM=AUTO
Table EMPLOYEE:
10 Rows successfully loaded.
Check the log files:
EMPLOYEE.log
EMPLOYEE_%p.log_xt
for more information about the load.
Lets check the logs
[oracle@Geek DBA12c ~]$ ls -ltr
total 88
-rw-r--r--. 1 oracle oinstall 140 Sep 16 20:58 EMPLOYEE.dat
-rw-r--r--. 1 oracle oinstall 1044 Sep 16 21:01 EMPLOYEE_2288.log_xt
-rw-r--r--. 1 oracle oinstall 2355 Sep 16 21:01 EMPLOYEE.log
[oracle@Geek DBA12c ~]$
My Table is sucessfully loaded, Also if you look at log ,
a) Express Mode is used
b) Parallel DML is automatically enabled
c) Control file like file automatically created and used.
[oracle@Geek DBA12c ~]$ cat EMPLOYEE.log
SQL*Loader: Release 12.1.0.1.0 - Production on Mon Sep 16 21:01:11 2013
Copyright (c) 1982, 2013, Oracle and/or its affiliates. All rights reserved.
Express Mode Load, Table: EMPLOYEE
Data File: EMPLOYEE.dat
Bad File: EMPLOYEE_%p.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Continuation: none specified
Path used: External Table
Table EMPLOYEE, loaded from every logical record.
Insert option in effect for this table: APPEND
Column Name Position Len Term Encl Datatype
------------------------------ ---------- ----- ---- ---- ---------------------
EMPLOYEE_ID FIRST * , CHARACTER
EMPLOYEE_NAME NEXT * , CHARACTER
Generated control file for possible reuse:
OPTIONS(EXTERNAL_TABLE=EXECUTE, TRIM=LRTRIM)
LOAD DATA
INFILE 'EMPLOYEE'
APPEND
INTO TABLE EMPLOYEE
FIELDS TERMINATED BY ","
(
EMPLOYEE_ID,
EMPLOYEE_NAME
)
End of generated control file for possible reuse.
created temporary directory object SYS_SQLLDR_XT_TMPDIR_00000 for path /home/oracle
enable parallel DML: ALTER SESSION ENABLE PARALLEL DML
creating external table "SYS_SQLLDR_X_EXT_EMPLOYEE"
CREATE TABLE "SYS_SQLLDR_X_EXT_EMPLOYEE"
(
"EMPLOYEE_ID" NUMBER,
"EMPLOYEE_NAME" VARCHAR2(50)
)
ORGANIZATION external
(
TYPE oracle_loader
DEFAULT DIRECTORY SYS_SQLLDR_XT_TMPDIR_00000
ACCESS PARAMETERS
(
RECORDS DELIMITED BY NEWLINE CHARACTERSET US7ASCII
BADFILE 'SYS_SQLLDR_XT_TMPDIR_00000':'EMPLOYEE_%p.bad'
LOGFILE 'EMPLOYEE_%p.log_xt'
READSIZE 1048576
FIELDS TERMINATED BY "," LRTRIM
REJECT ROWS WITH ALL NULL FIELDS
(
"EMPLOYEE_ID" CHAR(255),
"EMPLOYEE_NAME" CHAR(255)
)
)
location
(
'EMPLOYEE.dat'
)
)REJECT LIMIT UNLIMITED
executing INSERT statement to load database table EMPLOYEE
INSERT /*+ append parallel(auto) */ INTO EMPLOYEE
(
EMPLOYEE_ID,
EMPLOYEE_NAME
)
SELECT
"EMPLOYEE_ID",
"EMPLOYEE_NAME"
FROM "SYS_SQLLDR_X_EXT_EMPLOYEE"
dropping external table "SYS_SQLLDR_X_EXT_EMPLOYEE"
Table EMPLOYEE:
10 Rows successfully loaded.
Run began on Mon Sep 16 21:01:11 2013
Run ended on Mon Sep 16 21:01:12 2013
Elapsed time was: 00:00:01.69
CPU time was: 00:00:00.01
[oracle@Geek DBA12c ~]$ cat EMPLOYEE_2288.log_xt
LOG file opened at 09/16/13 21:01:11
Field Definitions for table SYS_SQLLDR_X_EXT_EMPLOYEE
Record format DELIMITED BY NEWLINE
Data in file has same endianness as the platform
Reject rows with all null fields
Fields in Data Source:
EMPLOYEE_ID CHAR (255)
Terminated by ","
Trim whitespace from left and right
EMPLOYEE_NAME CHAR (255)
Terminated by ","
Trim whitespace from left and right
LOG file opened at 09/16/13 21:01:12
KUP-05004: Warning: Intra source concurrency disabled because parallel select was not requested.
Field Definitions for table SYS_SQLLDR_X_EXT_EMPLOYEE
Record format DELIMITED BY NEWLINE
Data in file has same endianness as the platform
Reject rows with all null fields
Fields in Data Source:
EMPLOYEE_ID CHAR (255)
Terminated by ","
Trim whitespace from left and right
EMPLOYEE_NAME CHAR (255)
Terminated by ","
Trim whitespace from left and right
[oracle@Geek DBA12c ~]$
Hope this helps.
-Thanks
Geek DBA
Hello All,
I have received an email with an attachment about schema level Replication using Oracle Streams, indeed very nice and good Document.
Thanks to Mr. SivaKrishna B for his efforts in preparing this nice and very well structured document , I would like to appreciate his kind gesture to share his document to all of you with this blog. Personally, I know him very well and he used to discuss a lot on Subject with me Via e-mails and always keen to learn and implement Oracle database stuff.
Hope this document will help you if you are in need, and If you would like to send your feedback please use comment section in the post.
You can download the same here (PDF & DOC)
Streams Schema Level Replication.pdf
Streams Schema Level Replication.Doc
-Thanks
Geek DBA
From 12c Onwards, Oracle statistics gathering has been improvised and after bulk load operations the statistics will be gather automatically. Earlier, Create as select , or Insert as select operations required manual statistics gathering, where in this has been removed now. The following bulk operations is supportive for automatic statistics gather on fly.
CREATE TABLE AS SELECT
INSERT INTO ... SELECT into an empty table using a direct path insert
INSERT INTO ... SELECT into a non-empty table, partition, or subpartition
However there are Restrictions for those object that:-
The objects must not belong to SYS.
It is in an Oracle-owned schema such as SYS.
It is a nested table.
It is an index-organized table (IOT).
It is an external table.
It is a global temporary table defined as ON COMMIT DELETE ROWS.
It has virtual columns.
It has a PUBLISH preference set to FALSE.
It is partitioned, INCREMENTAL is set to true, and extended syntax is not used.
Let's do a quick test.
SQL> conn test/test@pdb12c
Connected.
SQL> create table t4 as select * from dba_objects;
Table created.
SQL> select table_name,num_rows,last_analyzed from dba_tables where table_name='T4';
TABLE_NAME NUM_ROWS LAST_ANAL
-------------------- ---------- ---------
T4 90776 15-SEP-13
As You see, the last analyzed column is updated and num_rows also, In addition to that, now dba_tab_col_statistics has a new column "notes" where the value updated for this type is stats_on_load
SQL> select column_name,table_name,notes from dba_tab_col_statistics where table_name='T4';
COLUMN_NAME TABLE_NAME NOTES
---------------------------------------- -------------------- -----------------------------------------
ORACLE_MAINTAINED T4 STATS_ON_LOAD
EDITIONABLE T4 STATS_ON_LOAD
SHARING T4 STATS_ON_LOAD
EDITION_NAME T4 STATS_ON_LOAD
NAMESPACE T4 STATS_ON_LOAD
SECONDARY T4 STATS_ON_LOAD
GENERATED T4 STATS_ON_LOAD
TEMPORARY T4 STATS_ON_LOAD
STATUS T4 STATS_ON_LOAD
TIMESTAMP T4 STATS_ON_LOAD
LAST_DDL_TIME T4 STATS_ON_LOAD
COLUMN_NAME TABLE_NAME NOTES
---------------------------------------- -------------------- -----------------------------------------
CREATED T4 STATS_ON_LOAD
OBJECT_TYPE T4 STATS_ON_LOAD
DATA_OBJECT_ID T4 STATS_ON_LOAD
OBJECT_ID T4 STATS_ON_LOAD
SUBOBJECT_NAME T4 STATS_ON_LOAD
OBJECT_NAME T4 STATS_ON_LOAD
OWNER T4 STATS_ON_LOAD
18 rows selected.
This feature is extremely helpful where lot of bulk load operations performed and required manual statistics collection.
-Thanks Geek DBA
|
Follow Me!!!