export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI" CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u03/oracle/backup/%F'; CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1; CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u03/oracle/backup/%U';
BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG; BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT '/home/oracle/%U' PLUS ARCHIVELOG; BACKUP ARCHIVELOG FROM SEQUENCE 7500; BACKUP ARCHIVELOG FROM SEQUENCE 7500 UNTIL SEQUENCE 8000 FORMAT '/home/oracle/%U'; BACKUP ARCHIVELOG FROM TIME 'SYSDATE -1'; DELETE ARCHIVELOG ALL; DELETE ARCHIVELOG ALL COMPLETED BEFORE 'sysdate -7'; LIST BACKUP OF ARCHIVELOG SEQUENCE xxxxx; LIST BACKUP OF ARCHIVELOG FROM SEQUENCE xxxxx; LIST BACKUP OF ARCHIVELOG SEQUENCE BETWEEN xxxxx AND xxxxx; CATALOG START WITH '<FILE_LOCATION>'; -- Data files showing in wrong location in control file CATALOG START WITH '<DATAFILE_LOCATION>'; SWITCH DATABASE TO COPY; RECOVER DATABASE;
SET linesize 120 col name format a20 SELECT name, space_limit/1024/1024 SPACE_LIMIT_MB, space_used/1024/1024 SPACE_USED_MB, space_reclaimable/1024/1024 SPACE_RECLAIMABLE_MB, NUMBER_OF_FILES FROM V$RECOVERY_FILE_DEST; SELECT * FROM V$RECOVERY_AREA_USAGE;
This procedure is useful if a standby database has missing archive logs.
COL CURRENT_SCN FORMAT 999999999999999 SELECT CURRENT_SCN FROM V$DATABASE; SELECT MIN(FHSCN) FROM X$KCVFH;
Example lowest number is 123456
RMAN> BACKUP INCREMENTAL FROM SCN 123456 DATABASE FORMAT 'F:\ad-hoc_backup\CPHG\ForStandby_%U' tag 'INCR_STANDBY';
Copy backup file to the standby database server.
RMAN> CATALOG START WITH 'F:\adhoc_backup\CPHG'; RMAN> RECOVER DATABASE NOREDO;
Backup the control file on the primary server.
RMAN> BACKUP CURRENT CONTROLFILE FOR STANDBY FORMAT 'F:\ad-hoc_backup\CPHG\standby.ctl';
Copy control file backup to the standby server.
If database locations are different on the standby server record the names …
RMAN> REPORT SCHEMA; RMAN> SHUTDOWN IMMEDIATE ; RMAN> STARTUP NOMOUNT; RMAN> RESTORE STANDBY CONTROLFILE FROM 'F:\adhoc_backup\CPHG\standby.ctl'; SQL> SHUTDOWN; SQL> STARTUP MOUNT; RMAN> CATALOG START WITH '<DATAFILE_LOCATION>'; RMAN> SWITCH DATABASE TO COPY;
If this is a Data Guard configuration then clear the standby redo log groups.
SQL> ALTER DATABASE CLEAR LOGFILE GROUP <STBY_GROUP_NO>;
-- Active RMAN Job SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK, ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE" FROM V$SESSION_LONGOPS WHERE OPNAME LIKE 'RMAN%' AND OPNAME NOT LIKE '%aggregate%' AND TOTALWORK != 0 AND SOFAR <> TOTALWORK
-- Last RMAN Operation col object_type format a15 ALTER SESSION SET nls_date_format='DD-MON-YYYY hh24:mi:ss'; SELECT object_type,mbytes_processed, start_time, end_time,STATUS FROM v$rman_status WHERE session_recid = (SELECT MAX(session_recid) FROM v$rman_status) AND operation !='RMAN' ORDER BY recid;
SET LINES 300 SET pages 1000 col cf FOR 99 col df FOR 99 col elapsed_seconds heading "ELAPSED|SECONDS" col i0 FOR 99 col i1 FOR 99 col l FOR 99 col output_mbytes FOR 9,999,999 heading "OUTPUT|MBYTES" col session_recid FOR 9999999 heading "SESSION|RECID" col session_stamp FOR 99999999999 heading "SESSION|STAMP" col STATUS FOR a10 trunc col time_taken_display FOR a10 heading "TIME|TAKEN" col output_instance FOR 9999 heading "OUT|INST" col start_time FOR a25 col end_time FOR a25 col START_DOW FOR a10 col L FOR 999 col INPUT_BYTES_DISPLAY FOR a9 heading "INPUT|SIZE" col OUTPUT_BYTES_DISPLAY FOR a9 heading "OUTPUT|SIZE" col INPUT_BYTES_PER_SEC_DISPLAY FOR a9 heading "INPUT|PERSEC" col OUTPUT_BYTES_PER_SEC_DISPLAY FOR a9 heading "OUTPUT|PERSEC" SELECT j.session_recid, j.session_stamp, to_char(j.start_time, 'yyyy-mm-dd hh24:mi:ss') start_time, to_char(j.end_time, 'yyyy-mm-dd hh24:mi:ss') end_time, j.status, j.input_type, to_char(j.start_time, 'DAY') START_DOW, j.time_taken_display, INPUT_BYTES_DISPLAY, OUTPUT_BYTES_DISPLAY, INPUT_BYTES_PER_SEC_DISPLAY, OUTPUT_BYTES_PER_SEC_DISPLAY, x.cf, x.df, x.i0, x.i1, x.l FROM V$RMAN_BACKUP_JOB_DETAILS j LEFT OUTER JOIN (SELECT d.session_recid, d.session_stamp, SUM(CASE WHEN d.controlfile_included = 'YES' THEN d.pieces ELSE 0 END) CF, SUM(CASE WHEN d.controlfile_included = 'NO' AND d.backup_type||d.incremental_level = 'D' THEN d.pieces ELSE 0 END) DF, SUM(CASE WHEN d.backup_type||d.incremental_level = 'D0' THEN d.pieces ELSE 0 END) I0, SUM(CASE WHEN d.backup_type||d.incremental_level = 'I1' THEN d.pieces ELSE 0 END) I1, SUM(CASE WHEN d.backup_type = 'L' THEN d.pieces ELSE 0 END) L FROM V$BACKUP_SET_DETAILS d JOIN V$BACKUP_SET s ON s.set_stamp = d.set_stamp AND s.set_count = d.set_count WHERE s.input_file_scan_only = 'NO' GROUP BY d.session_recid, d.session_stamp) x ON x.session_recid = j.session_recid AND x.session_stamp = j.session_stamp LEFT OUTER JOIN (SELECT o.session_recid, o.session_stamp, MIN(inst_id) inst_id FROM GV$RMAN_OUTPUT o GROUP BY o.session_recid, o.session_stamp) ro ON ro.session_recid = j.session_recid AND ro.session_stamp = j.session_stamp WHERE j.start_time > trunc(sysdate)-&NUMBER_OF_DAYS ORDER BY j.start_time;