Tuesday, October 9, 2012

Backup - PACKAGE



set pagesize 0
set linesize 800
set trimspool on
set heading off
set feedback off
spool PACKAGE NAME.pkb
select text from dba_source where name='<PACKAGE NAME>' and type='PACKAGE BODY';
spool off

set linesize 500
set pagesize 100000
set head off
set verify off
spool PACKAGE NAME.pks
select text from dba_source where name='<PACKAGE NAME>' and type='PACKAGE';
spool off

---------------------------------------

RMAN COLD BACKUP script:
========================
sql> shutdown immediate;
sql> startup mount
$ rman target /
rman> RUN
 {
 ALLOCATE CHANNEL CH1 DEVICE TYPE DISK
 FORMAT '/s029/so/backup/oracle/gisq1_cold_bkp/%d_COLD_%M%D%Y_%p_%s'
 ;
 ALLOCATE CHANNEL CH2 DEVICE TYPE DISK
 FORMAT '/s029/so/backup/oracle/gisq1_cold_bkp/%d_COLD_%M%D%Y_%p_%s'
 ;
 ALLOCATE CHANNEL CH3 DEVICE TYPE DISK
 FORMAT '/s029/so/backup/oracle/gisq1_cold_bkp/%d_COLD_%M%D%Y_%p_%s'
 ;
 ALLOCATE CHANNEL CH4 DEVICE TYPE DISK
 FORMAT '/s029/so/backup/oracle/gisq1_cold_bkp/%d_COLD_%M%D%Y_%p_%s'
 ;
 BACKUP
 AS COMPRESSED BACKUPSET
 FULL
 DATABASE
 TAG ent1_COLD_0511_1039
 ;
 BACKUP FORMAT '/s029/so/backup/oracle/gisq1_cold_bkp/%d_%M_%D_%Y_%t.ctl'
 CURRENT CONTROLFILE
 TAG gisq1_CONTROLFILE_0511_1039
 ;
 }
> sql 'alter database open';
RMAN HOT BACKUP SCRIPT:
=======================
rman msglog /atpwecq1/dbdata/data1/workorders/rman/rman_backup.log <<EOF
connect target /
RUN
{
  ALLOCATE CHANNEL ch00 DEVICE TYPE DISK FORMAT '/atpwecq1/dbdata/data1/workorders/rman/%d_db_u%u_s%s_p%p_t%t';
  ALLOCATE CHANNEL ch01 DEVICE TYPE DISK FORMAT '/atpwecq1/dbdata/data1/workorders/rman/%d_db_u%u_s%s_p%p_t%t';
  backup as compressed backupset full database TAG 'evnmond1';
  RELEASE CHANNEL ch00;
  RELEASE CHANNEL ch01;
  sql "alter system archive log current";
  backup as compressed backupset archivelog all FORMAT '/atpwecq1/dbdata/data1/workorders/rman/arch-s%s-p%p-t%t'  TAG 'evnmond1';
BACKUP FORMAT '/atpwecq1/dbdata/data1/workorders/rman/bk_u%u_s%s_p%p_t%t.ctl' CURRENT CONTROLFILE;
}
exit;
EOF

No comments:

Post a Comment