Posts

Showing posts with the label Apps DBA

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')

Changing the Archive Log Destination

  SQL> ALTER SYSTEM SET log_archive_dest_1 = '/data/backup/archive' scope=spfile; System altered. SQL> show parameter log_archive_dest

User open and grant permission as DBA

 CREATE USER SABUJ IDENTIFIED BY 123456; GRANT UNLIMITED TABLESPACE TO SABUJ ; GRANT CONNECT TO SABUJ; GRANT DBA TO SABUJ; COMMIT; host imp user/password@tnsname fromuser=SABUJ touser=SABUJ file=FC.DMP log=FC.log exp user/password@tnsname file=FC-%date%.dmp log=fc.log statistics=none

Backup Command

  full database backup: ================================================= run { allocate channel c1 type disk; backup as backupset format '/u01/app/oracle/rman_bk/df_%d_%s_%p' incremental level 0 database; backup as backupset format '/u01/app/oracle/rman_bk/ar_%d_%s_%p' archivelog all delete input; } differential incremental database backup: ================================================= run { allocate channel c1 type disk; backup as backupset format '/u01/app/oracle/rman_bk/df_%d_%s_%p' incremental level 1 database; backup as backupset format '/u01/app/oracle/rman_bk/ar_%d_%s_%p' archivelog all delete input; } cumulative incremental database backup: ================================================= run { allocate channel c1 type disk; backup as backupset format '/u01/app/oracle/rman_bk/df_%d_%s_%p' incremental level 1 cumulative database; backup as backupset format '/u01/app/oracle/rman_bk/ar_%d_%s_%p' archivelog all delete input; } e...