Saturday, June 30, 2012

QUERY - BACKUP


QUERY - BACKUP



Oracle Home and Inventory Backup


tar -cvf $ORACLE_HOME $ORACLE_HOME/oraInventory | gzip > Backup_Software_Version.tar.gz



Note: 
tar -cvf <destination_location> <source_location>


ORACLE_HOME & ORACLE_CRS_HOME backup’s (for all nodes in RAC)
cd /u01/before_patch_backup
tar -cvf oracle_base_jun30.tar $ORACLE_BASE
tar -cvf oracle_home_jun30.tar $ORACLE_HOME
tar -cvf oracle_crs_home_jun30.tar $ORACLE_CRS_HOME




All Users passwords backup


spool ./users_pwd_backup.log
select 'alter user '||username||' identified by values '||password||';' from dba_users;  ( For 10g database)
select 'alter user '||name||' identified by values '||password||';' from SYS.USER$; ( For 11g database)
spool off


Database links backup


All DBlinks backup:
set pages 0
set long 90000
SELECT u.OWNER,DBMS_METADATA.GET_DDL('DB_LINK',u.DB_LINK,u.OWNER) FROM dba_db_links u;


For a specific DBlink backup:
set pages 0
set long 90000
SELECT DBMS_METADATA.GET_DDL('DB_LINK','DB_LINK_NAME','USER_NAME') FROM dba_db_links;


Controlfile Backup


alter database backup controlfile to trace; 


show parameter user_dump_dest
(go to udump dest and make the note of controlfile trace)



"Hope for the best, prepare for the worst"
-Dharmendra

No comments:

Post a Comment