Posts

Showing posts from July, 2022

impdp & expdp

  directory creation command  CREATE OR REPLACE DIRECTORY bk_directory AS '/data/back'; Export data pump command expdp user/passs@tns schemas=QTAN dumpfile=qtann.dmp logfile=qtannll.log Import data pump command impdp user/pass@tns schemas=QTAN REMAP_SCHEMA=QTAN:VHCL dumpfile=qtann.dmp logfile=qtannimp.log CREATE USER SABUJ IDENTIFIED BY 1121; GRANT UNLIMITED TABLESPACE TO SABUJ ; GRANT CONNECT TO SABUJ; GRANT DBA TO SABUJ; COMMIT; host imp FC/fcc@DITF_RFL fromuser=FC touser=FC file=FC.DMP log=FC.log

Move all table or index to a new / different tablespace while it is online

 select 'alter index '||owner||'.'||index_name||' rebuild tablespace TBS_INDEX ONLINE;' from all_indexes where owner='SABUJ'; select 'ALTER TABLE '||owner||'.'||TABLE_NAME||' MOVE ONLINE tablespace TBS_DATA ;' from all_tables where owner='SABUJ'; SELECT 'ANALYZE TABLE '||owner||'.' || table_name || ' COMPUTE STATISTICS;' FROM   all_tables WHERE  owner in  ('SABUJ','HRMS') ORDER BY 1; select 'analyze index '||owner||'.'||index_name||' validate structure;' from dba_indexes where owner in  ('SABUJ','HRMS')