Oracle OCP IZ0-053 Q311(Rman catalog stored scripts)

abstractcyj發表於2016-03-21
311.Given the script
create script db_backup_datafile_script
{backup datafile and 1, and2 plus archivelog delete input;}
What is the result of running this command?
Run {execute script db_backup_datafile_script using 2;}
A. The script will fail since you instructed RMAN to back up only one datafile rather than two.
B. The script will successfully back up datafile 3 without error.
C. The script will fail since it uses a substitution variable which is not supported.
D. The execute script command will prompt for the value of and2 since it's not included in the command.
E. The script will fail because you cannot use the plus archivelog command when backing up database
datafiles.
Answer: D

官方參考:
https://docs.oracle.com/cd/B28359_01/backup.111/b28270/rcmcatdb.htm#i1006678

貌似是考察RMAN Stored scripts裡的佔位符。

RMAN> create script db_backup_datafile_script {backup datafile and 1, and2 plus archivelog delete input;}


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "and": expecting one of: "double-quoted-string, integer, single-quoted-string"
RMAN-01007: at line 1 column 58 file: standard input


RMAN> create script db_backup_datafile_script
2> {backup datafile &1, &2 plus archivelog delete input;}


Enter value for 1: 1


Enter value for 2: 2


starting full resync of recovery catalog
full resync complete
created script db_backup_datafile_script


RMAN> create script db_backup_datafile_script
2> {backup datafile :1, :2 plus archivelog delete input;}


RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "colon": expecting one of: "double-quoted-string, integer, single-quoted-string"
RMAN-01007: at line 2 column 18 file: standard input


RMAN> Run {execute script db_backup_datafile_script using 2;}


executing script: db_backup_datafile_script


Enter value for 2: 2




Starting backup at 21-MAR-16
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=146 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=20 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=15 RECID=18 STAMP=907079582
channel ORA_DISK_1: starting piece 1 at 21-MAR-16

指定所有的佔位符,沒有出現提示:
RMAN> Run {execute script db_backup_datafile_script using 2 1;}


executing script: db_backup_datafile_script




Starting backup at 21-MAR-16
current log archived
using channel ORA_DISK_1
using channel ORA_DISK_2
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=20 RECID=23 STAMP=907086392
channel ORA_DISK_1: starting piece 1 at 21-MAR-16
channel ORA_DISK_1: finished piece 1 at 21-MAR-16
piece handle=/home/oracle/1fr122hq_1_1 tag=TAG20160321T162633 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/app/oracle/fast_recovery_area/INST1/archivelog/2016_03_21/o1_mf_1_20_cgzd1rxn_.arc RECID=23 STAMP=907086392
Finished backup at 21-MAR-16

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8520577/viewspace-2061211/,如需轉載,請註明出處,否則將追究法律責任。

相關文章