[20170703]从备份集取出spfile转化为pfile.txt

时间:2024-01-10 09:10:26

[20170703]从备份集取出spfile转化为pfile.txt

--//上个星期的事情,要从备份集里面取出看看spfile文件某个参数当时的情况,结果尝试命令老是出错,做一个记录.
--//最后选择通过awr报表来查看当时某个参数的情况.

1.环境:
SYS@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

RMAN> backup spfile ;
Starting backup at 2017-07-03 11:01:52
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 2017-07-03 11:01:53
channel ORA_DISK_1: finished piece 1 at 2017-07-03 11:01:54
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_07_03/o1_mf_nnsnf_TAG20170703T110152_domdx129_.bkp tag=TAG20170703T110152 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2017-07-03 11:01:54
Starting Control File and SPFILE Autobackup at 2017-07-03 11:01:54
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/autobackup/2017_07_03/o1_mf_s_948366114_domdx25y_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2017-07-03 11:01:55

--//假设我现在要从这个备份集文件/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_07_03/o1_mf_nnsnf_TAG20170703T110152_domdx129_.bkp
--//取出spfile转化pfile.执行如下:

RMAN> restore spfile to pfile '/tmp/book.txt' from '/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_07_03/o1_mf_nnsnf_TAG20170703T110152_domdx129_.bkp' ;
Starting restore at 2017-07-03 11:03:39
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_2: skipped, AUTOBACKUP already found
channel ORA_DISK_3: skipped, AUTOBACKUP already found
channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_07_03/o1_mf_nnsnf_TAG20170703T110152_domdx129_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 2017-07-03 11:03:48

$ head /tmp/book.txt
book.__db_cache_size=423624704
book.__java_pool_size=16777216
book.__large_pool_size=29360128
book.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
book.__pga_aggregate_target=209715200
book.__sga_target=637534208
book.__shared_io_pool_size=0
book.__shared_pool_size=184549376
book.__streams_pool_size=0
*._cursor_bind_capture_area_size=2001
--//ok,成功!!
--//我当时在pfile 与文件之间加入等号,执行如下:

RMAN> restore spfile to pfile='/tmp/book.txt' from '/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_07_03/o1_mf_nnsnf_TAG20170703T110152_domdx129_.bkp' ;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "equal": expecting one of: "double-quoted-string, single-quoted-string"
RMAN-01007: at line 1 column 24 file: standard input

--//实际上如果仔细看提示,就知道问题在那里.已经提示很明确了.
RMAN-01009: syntax error: found "equal": expecting one of: "double-quoted-string, single-quoted-string"