To display time / date during RMAN operations, follow the procedure:
TIMESTAMP FOR NT
------------------
To get time / date displayed during an RMAN operation the OS command (time and
date) should be
used with the option /T ( to stop the OS requiring user interaction)
To display a timestamp in the RMAN log, run something similar to the following -
RMAN >run{
allocate channel a1 type disk
.
.
.
HOST 'time /T';
HOST 'date /T';
release channel a1;
}
Output looks like -
04:09 PM
host command complete
24/07/2002
host command complete
--------------------------------------------------------------------------------
-
If you want the Time or Date to be recorded in a file you can use the following
-
RMAN> run{
host 'echo Backup stored in logfile (logrman.txt) taken on ->d:
\oracle\ora81\rmanbkp\rmandate.log';
host 'time /T>>d:\oracle\ora81\rmanbkp\rmandate.log';
host 'date /T>>d:\oracle\ora81\rmanbkp\rmandate.log';
}
This will produce a file that has -
Backup stored in logfile (logrman.txt) taken on -
16:57
05-Sep-2002
TIMESTAMP FOR UNIX
--------------------
To get time / date displayed during an RMAN operation the OS command (date)
should be used.
To display a timestamp in the RMAN log, run something similar to the following -
RMAN >run{
allocate channel a1 type disk
.
.
.
HOST 'date';
release channel a1;
}
Output looks like -
RMAN-03022: compiling command: host
Wed Jul 24 16:31:06 BST 2002
RMAN-06134: host command complete
--------------------------------------------------------------------------------
-
If you want the Time or Date to be recorded in a file you can use the following
-
RMAN> run{
host 'echo Backup stored in logfile (logrman.txt) taken on ->/tmp/rmandate.
log';
host 'date>>/tmp/rmandate.log';
}
This will produce a file that has -
Backup stored in logfile (logrman.txt) taken on -
Thu Sep 5 16:49:51 BST 2002
Showing posts with label RMAN. Show all posts
Showing posts with label RMAN. Show all posts
Monday, September 21, 2009
Wednesday, April 8, 2009
RMAN: SET NEWNAME Command Using SQL
When you must restore the database the same directory structure is not always there. If you have a database containing 1000s of datafiles it can be very tedious to setup the set newname commands for all the datafiles. Using sqlplus we can extract the information we need into a file which can then be easily modifed and executed as an RMAN script to complete the task.
===================================================
sqlplus /nolog
connect system/manager
set echo off pages 0 feed off sqlp #
spool /path/setnewnamedf.lst
select 'set newname for datafile 'file#' to NEW;' from v$datafile;
-- select 'set newname for datafile 'file#' to /newpath/NEW;' from v$datafile;
spool off
===================================================
There are 2 select statements above with slightly different output.
Select #1 Output:
set newname for datafile 1 to NEW;
set newname for datafile 2 to NEW;
set newname for datafile 3 to NEW;
set newname for datafile 4 to NEW;
set newname for datafile 5 to NEW;
Select #2 Output:
set newname for datafile 1 to /newpath/NEW;
set newname for datafile 2 to /newpath/NEW;
set newname for datafile 3 to /newpath/NEW;
set newname for datafile 4 to /newpath/NEW;
set newname for datafile 5 to /newpath/NEW;
To generate set newname commands to point to an ASM volume execute the sql below
===================================================
sqlplus /nolog
connect system/manager
set echo off pages 0 feed off sqlp #
spool /path/setnewnamedf.lst
select 'set newname for datafile 'file#' to ''+DG'';' from v$datafile;
spool off
===================================================
===================================================
sqlplus /nolog
connect system/manager
set echo off pages 0 feed off sqlp #
spool /path/setnewnamedf.lst
select 'set newname for datafile 'file#' to NEW;' from v$datafile;
-- select 'set newname for datafile 'file#' to /newpath/NEW;' from v$datafile;
spool off
===================================================
There are 2 select statements above with slightly different output.
Select #1 Output:
set newname for datafile 1 to NEW;
set newname for datafile 2 to NEW;
set newname for datafile 3 to NEW;
set newname for datafile 4 to NEW;
set newname for datafile 5 to NEW;
Select #2 Output:
set newname for datafile 1 to /newpath/NEW;
set newname for datafile 2 to /newpath/NEW;
set newname for datafile 3 to /newpath/NEW;
set newname for datafile 4 to /newpath/NEW;
set newname for datafile 5 to /newpath/NEW;
To generate set newname commands to point to an ASM volume execute the sql below
===================================================
sqlplus /nolog
connect system/manager
set echo off pages 0 feed off sqlp #
spool /path/setnewnamedf.lst
select 'set newname for datafile 'file#' to ''+DG'';' from v$datafile;
spool off
===================================================
Monday, March 30, 2009
Relation between RMAN retention period and control_file_record_keep_time
RMAN backup keeps the backup metadata information in the reusable section of the controlfile. Its depends on the parameter CONTROL_FILE_RECORD_KEEP_TIME.
CONTROL_FILE_RECORD_KEEP_TIME specifies the minimum number of days before a reusable record in the control file can be reused. In the event a new record needs to be added to a reusable section and there is not enough space then it will delete the oldest record, which are aged enough. Backup retention policy is the rule to set regarding which backups must be retained (whether on disk or other backup media) to meet the recovery and other requirements. If the CONTROL_FILE_RECORD_KEEP_TIME is less than the retention policy then it may overwrite reusable records prior to obsoleting them in the RMAN metadata. Therfore it is recommended that the CONTROL_FILE_RECORD_KEEP_TIME should set to a higher value than the retention policy. Formula CONTROL_FILE_RECORD_KEEP_TIME = retention period + level 0 backup interval + 1
For e.g:
A level 0 backup once a week with retention policy of a recovery windows of 14 days then in this case the CONTROL_FILE_RECORD_KEEP_TIME should be 14+7+1=22
CONTROL_FILE_RECORD_KEEP_TIME specifies the minimum number of days before a reusable record in the control file can be reused. In the event a new record needs to be added to a reusable section and there is not enough space then it will delete the oldest record, which are aged enough. Backup retention policy is the rule to set regarding which backups must be retained (whether on disk or other backup media) to meet the recovery and other requirements. If the CONTROL_FILE_RECORD_KEEP_TIME is less than the retention policy then it may overwrite reusable records prior to obsoleting them in the RMAN metadata. Therfore it is recommended that the CONTROL_FILE_RECORD_KEEP_TIME should set to a higher value than the retention policy. Formula CONTROL_FILE_RECORD_KEEP_TIME = retention period + level 0 backup interval + 1
For e.g:
A level 0 backup once a week with retention policy of a recovery windows of 14 days then in this case the CONTROL_FILE_RECORD_KEEP_TIME should be 14+7+1=22
Subscribe to:
Posts (Atom)