[20161101]環境變數ORA_RMAN_SGA_TARGET
[20161101]環境變數ORA_RMAN_SGA_TARGET.txt
--如果資料庫恢復,需要啟動資料庫到nomount,如果沒有spfile檔案,在sqlplus是無法啟動的。
--在rman環境下,可以啟動到nomount,解決雞與蛋的問題,有一個環境變數ORA_RMAN_SGA_TARGET控制sga大小。
--測試看看:
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
--關閉資料庫,改名spfile檔案,如果存在init檔案也改名。
$ cd /u01/app/oracle/product/11.2.0.4/dbhome_1/dbs
$ mv spfilebook.ora spfilebook.ora_20161101
2.啟動看看:
--可以設定引數可以改變sga記憶體大小.
export ORA_RMAN_SGA_TARGET=512
SYS@book> startup nomount
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/initbook.ora'
--在sqlplus無法啟動到nomount.
RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/initbook.ora'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area 534462464 bytes
Fixed Size 2254952 bytes
Variable Size 272631704 bytes
Database Buffers 251658240 bytes
Redo Buffers 7917568 bytes
SYS@book> show sga
Total System Global Area 534462464 bytes
Fixed Size 2254952 bytes
Variable Size 272631704 bytes
Database Buffers 251658240 bytes
Redo Buffers 7917568 bytes
SYS@book> show parameter sga_target
NAME TYPE VALUE
----------- ------------- ---------
sga_target big integer 512M
--可以發現SGA使用512M。與設定相符。
2.如果不設定呢?
$ export ORA_RMAN_SGA_TARGET=
$ rlrman
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Nov 1 08:10:54 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup nomount
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0.4/dbhome_1/dbs/initbook.ora'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 301990792 bytes
Database Buffers 754974720 bytes
Redo Buffers 9711616 bytes
--可以發現SGA_TARGET使用1024M.我一直想設定有什麼用,難道有可能出現太小或者太多無法啟動的情況嗎?
3. 測試恢復spfile檔案。一般spfile這個時候也有問題,必須先恢復pfile,再轉成spfile格式。
RMAN> restore spfile to pfile '/tmp/b.oar' from autobackup;
Starting restore at 2016-11-01 08:12:56
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1345 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 11/01/2016 08:12:57
RMAN-06495: must explicitly specify DBID with SET DBID command
--//原來這樣需要指定dbid,第一次遇到這種情況。
RMAN> set dbid 1337401710
executing command: SET DBID
RMAN> restore spfile to pfile '/tmp/b.oar' from autobackup;
Starting restore at 2016-11-01 08:19:29
using channel ORA_DISK_1
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20161101
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20161031
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20161030
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20161029
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20161028
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20161027
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20161026
channel ORA_DISK_1: no AUTOBACKUP in 7 days found
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 11/01/2016 08:19:31
RMAN-06172: no AUTOBACKUP found or specified handle is not a valid copy or piece
--奇怪不知道為什麼不行。實際上我喜歡直接指定路徑,這樣就不需要設定dbid了。
$ rlrman
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Nov 1 08:21:03 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: DUMMY (not mounted)
RMAN> restore spfile to pfile '/tmp/b.oar' from '/u01/app/oracle/fast_recovery_area/BOOK/autobackup/2016_11_01/o1_mf_s_926756227_d1hqr3pw_.bkp';
Starting restore at 2016-11-01 08:21:52
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1345 device type=DISK
channel ORA_DISK_1: restoring spfile from AUTOBACKUP /u01/app/oracle/fast_recovery_area/BOOK/autobackup/2016_11_01/o1_mf_s_926756227_d1hqr3pw_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 2016-11-01 08:21:54
$ head /tmp/b.oar
book.__db_cache_size=394264576
book.__java_pool_size=12582912
book.__large_pool_size=37748736
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=213909504
book.__streams_pool_size=0
*._cursor_bind_capture_area_size=2001
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2127385/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 環境變數變數
- Linux 新增環境變數和刪除環境變數Linux變數
- 簡述SHELL全域性環境變數與局變環境變數變數
- Java 環境變數Java變數
- jdk環境變數JDK變數
- DOS環境變數變數
- env 環境變數變數
- 環境變數path變數
- Java環境變數Java變數
- ORACLE 環境變數Oracle變數
- postman環境變數Postman變數
- 配置環境變數變數
- ubuntu JDK 環境變數UbuntuJDK變數
- 配置JDK環境變數JDK變數
- 環境變數詳解變數
- Flume 配置環境變數變數
- Shell配置環境變數變數
- Java環境變數新增Java變數
- 【Linux】環境變數!!!Linux變數
- Kaldi配置環境變數變數
- MySQL 環境變數配置MySql變數
- unix下環境變數 .變數
- Linux 環境變數Linux變數
- oracle 環境變數 redhatOracle變數Redhat
- 設定環境變數變數
- SQL*PLUS 環境變數SQL變數
- jdk環境變數配置JDK變數
- JDK配置環境變數JDK變數
- java環境變數配置Java變數
- java 配置環境變數Java變數
- windows配置環境變數Windows變數
- 什麼是環境變數?Python中如何設定環境變數?變數Python
- GBASEDBTSERVER 環境變數7GBASEDBTSHMBASE 環境變數 (UNIX™)Server變數
- linux環境顯示全部環境變數Linux變數
- 環境變數{Linux環境(也稱為Shell環境)}(轉)變數Linux
- 如何檢視Docker容器環境變數,如何向容器傳遞環境變數Docker變數
- Mac 設定環境變數的位置、檢視和新增PATH環境變數Mac變數
- Linux下將PHP新增到環境變數,將Mysql加入環境變數。LinuxPHP變數MySql