ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 在線做standby

在線做standby

原创 Linux操作系统 作者:tom_xieym 时间:2011-08-03 14:00:58 0 删除 编辑

一.主庫與從庫的oracle版本必須一致﹐主庫必須設置為歸檔模式(從庫安裝oracle并建庫)
二.強制主庫為logging狀態
Alter database force logging;

三.在主庫與從庫中同時生成密碼文件
以oracle用戶登陸
$rm $ORACLE_HOME/dbs/orapw$ORACLE_SID
$orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=oracle entries=4

wmrac01<*ccptdb1*/u01/product/oracle/11.2.0/db_1/dbs>$pwd
/u01/product/oracle/11.2.0/db_1/dbs
wmrac01<*ccptdb1*/u01/product/oracle/11.2.0/db_1/dbs>$ll
total 21084
-rw-rw---- 1 oracle asmadmin     1544 Mar  1 15:12 hc_ccptdb1.dat
-rw-r----- 1 oracle oinstall       39 Mar  1 17:12 initccptdb1.ora
-rw-r--r-- 1 oracle oinstall     2851 May 15  2009 init.ora
-rw-r----- 1 oracle oinstall     1536 Mar  9 10:05 orapwccptdb1
-rw-r----- 1 oracle asmadmin 21544960 May  6 17:37 snapcf_ccptdb1.f
wmrac01<*ccptdb1*/u01/product/oracle/11.2.0/db_1/dbs>$scp orapwccptdb1 10.118.253.47://u01/product/oracle/11.2.0/db_1/dbs/orapwccptdb

四.在主庫與從庫中設置相應的環境變量
以oracle用戶登陸
主庫﹕

node1 .bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

BASH_ENV=$HOME/.BASHRC
export BASH_ENV

export TEMP=/tmp
export TMPDIR=/tmp

PATH=$PATH:$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin
PATH=${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=${PATH}:/u01/product/common/oracle/bin
export PATH

export ORACLE_SID=ccptdb1
ORACLE_BASE=/u01/product/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/11.2.0/db_1; export ORACLE_HOME
ORACLE_TERM=vt100;export ORACLE_TERM
export PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH

#GRID_BASE=/u01/product/grid/crs; export ORACLE_BASE
#GRID_HOME=/u01/product/grid/11.2.0; export ORACLE_HOME
#export PATH=$GRID_HOME/bin:$PATH

JAVA_HOME=/usr/local/java;export JAVA_HOME
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH

set -u
#PS1=`hostname`'<$PWD>$';export PS1
PS1=`hostname`'<*$ORACLE_SID*$PWD>$';export PS1
EDITOR=/bin/vi; export EDITOR

alias ll='ls -l';
alias ls='ls --color';
alias his='history';

node2 .bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

BASH_ENV=$HOME/.BASHRC
export BASH_ENV

export TEMP=/tmp
export TMPDIR=/tmp

PATH=$PATH:$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin
PATH=${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=${PATH}:/u01/product/common/oracle/bin
export PATH

export ORACLE_SID=ccptdb2
ORACLE_BASE=/u01/product/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/11.2.0/db_1; export ORACLE_HOME
ORACLE_TERM=vt100;export ORACLE_TERM
export PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH

#GRID_BASE=/u01/product/grid/crs; export ORACLE_BASE
#GRID_HOME=/u01/product/grid/11.2.0; export ORACLE_HOME
#export PATH=$GRID_HOME/bin:$PATH

JAVA_HOME=/usr/local/java;export JAVA_HOME
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH

set -u
#PS1=`hostname`'<$PWD>$';export PS1
PS1=`hostname`'<*$ORACLE_SID*$PWD>$';export PS1
EDITOR=/bin/vi; export EDITOR

alias ll='ls -l';
alias ls='ls --color';
alias his='history';


備庫﹕

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

BASH_ENV=$HOME/.BASHRC
export BASH_ENV

export TEMP=/tmp
export TMPDIR=/tmp

PATH=$PATH:$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin
PATH=${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
PATH=${PATH}:/u01/product/common/oracle/bin
export PATH

export ORACLE_SID=ccptdb
ORACLE_BASE=/u01/product/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/11.2.0/db_1; export ORACLE_HOME
ORACLE_TERM=vt100;export ORACLE_TERM
export PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH

#GRID_BASE=/u01/product/grid/crs; export ORACLE_BASE
#GRID_HOME=/u01/product/grid/11.2.0; export ORACLE_HOME
#export PATH=$GRID_HOME/bin:$PATH

JAVA_HOME=/usr/local/java;export JAVA_HOME
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH

set -u
#PS1=`hostname`'<$PWD>$';export PS1
PS1=`hostname`'<*$ORACLE_SID*$PWD>$';export PS1
EDITOR=/bin/vi; export EDITOR

alias ll='ls -l';
alias ls='ls --color';
alias his='history';


五.主庫與從庫建立參數文件
在主庫中生成pfile
$sqlplus ‘/as sysdba’
 Create pfile=’/home/oracle/pfile.ora’ from spfile;
 
1. node1 pfile.ora

ccptdb1.__db_cache_size=4898947072
ccptdb2.__db_cache_size=5301600256
ccptdb1.__java_pool_size=67108864
ccptdb2.__java_pool_size=67108864
ccptdb1.__large_pool_size=67108864
ccptdb2.__large_pool_size=67108864
ccptdb1.__oracle_base='/u01/product/oracle'#ORACLE_BASE set from environment
ccptdb2.__oracle_base='/u01/product/grid/crs'#ORACLE_BASE set from environment
ccptdb1.__pga_aggregate_target=17381195776
ccptdb2.__pga_aggregate_target=16710107136
ccptdb1.__sga_target=9126805504
ccptdb2.__sga_target=9529458688
ccptdb1.__shared_io_pool_size=0
ccptdb2.__shared_io_pool_size=0
ccptdb1.__shared_pool_size=3758096384
ccptdb2.__shared_pool_size=3892314112
ccptdb1.__streams_pool_size=134217728
ccptdb2.__streams_pool_size=0
*.archive_lag_target=1800
ccptdb1.archive_lag_target=1800
ccptdb2.archive_lag_target=1800
*.audit_file_dest='/u01/product/oracle/admin/ccptdb/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.0.0'
*.control_files='+DATA/ccptdb/control01.ctl','+DATA/ccptdb/control02.ctl'
*.db_block_size=16384
*.db_domain=''
*.db_name='ccptdb'
*.db_recovery_file_dest='+DATA'
*.db_recovery_file_dest_size=5218762752
*.diagnostic_dest='/u01/product/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ccptdbXDB)'
ccptdb1.fal_client='CCPTDB1'
ccptdb2.fal_client='CCPTDB2'
*.fal_server='CCPTDBDG'
ccptdb1.instance_number=1
ccptdb2.instance_number=2
*.log_archive_config='DG_CONFIG=(ccptdb,ccptdbdg)'
*.log_archive_dest_1='LOCATION=+data VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ccptdb'
*.log_archive_dest_2='SERVICE=ccptdbdg LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ccptdbdg'
*.log_archive_format='%t_%s_%r.arc'
*.memory_target=26214400000
*.nls_sort='SCHINESE_PINYIN_M'
*.open_cursors=1000
*.processes=1000
*.remote_listener='wmscan:1521'
*.remote_login_passwordfile='exclusive'
*.sessions=1105
ccptdb2.thread=2
ccptdb1.thread=1
ccptdb2.undo_tablespace='UNDOTBS2'
ccptdb1.undo_tablespace='UNDOTBS1'

2. node2 pfile.ora

ccptdb1.__db_cache_size=4898947072
ccptdb2.__db_cache_size=5301600256
ccptdb1.__java_pool_size=67108864
ccptdb2.__java_pool_size=67108864
ccptdb1.__large_pool_size=67108864
ccptdb2.__large_pool_size=67108864
ccptdb1.__oracle_base='/u01/product/oracle'#ORACLE_BASE set from environment
ccptdb2.__oracle_base='/u01/product/grid/crs'#ORACLE_BASE set from environment
ccptdb1.__pga_aggregate_target=17381195776
ccptdb2.__pga_aggregate_target=16710107136
ccptdb1.__sga_target=9126805504
ccptdb2.__sga_target=9529458688
ccptdb1.__shared_io_pool_size=0
ccptdb2.__shared_io_pool_size=0
ccptdb1.__shared_pool_size=3758096384
ccptdb2.__shared_pool_size=3892314112
ccptdb1.__streams_pool_size=134217728
ccptdb2.__streams_pool_size=0
*.archive_lag_target=1800
ccptdb1.archive_lag_target=1800
ccptdb2.archive_lag_target=1800
*.audit_file_dest='/u01/product/oracle/admin/ccptdb/adump'
*.audit_trail='db'
*.cluster_database=true
*.compatible='11.2.0.0.0'
*.control_files='+DATA/ccptdb/control01.ctl','+DATA/ccptdb/control02.ctl'
*.db_block_size=16384
*.db_domain=''
*.db_name='ccptdb'
*.db_recovery_file_dest='+DATA'
*.db_recovery_file_dest_size=5218762752
*.diagnostic_dest='/u01/product/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ccptdbXDB)'
ccptdb1.fal_client='CCPTDB1'
ccptdb2.fal_client='CCPTDB2'
*.fal_server='CCPTDBDG'
ccptdb1.instance_number=1
ccptdb2.instance_number=2
*.log_archive_config='DG_CONFIG=(ccptdb,ccptdbdg)'
*.log_archive_dest_1='LOCATION=+data VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ccptdb'
*.log_archive_dest_2='SERVICE=ccptdbdg LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ccptdbdg'
*.log_archive_format='%t_%s_%r.arc'
*.memory_target=26214400000
*.nls_sort='SCHINESE_PINYIN_M'
*.open_cursors=1000
*.processes=1000
*.remote_listener='wmscan:1521'
*.remote_login_passwordfile='exclusive'
*.sessions=1105
ccptdb2.thread=2
ccptdb1.thread=1
ccptdb2.undo_tablespace='UNDOTBS2'
ccptdb1.undo_tablespace='UNDOTBS1'

注意主庫設置﹕
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(ccptdb,ccptdbdg)';
alter system set log_archive_dest_1='LOCATION=+data VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ccptdb';
alter system set  log_archive_dest_2='SERVICE=ccptdbdg LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ccptdbdg';
ALTER SYSTEM SET FAL_CLIENT = ccptdb1 sid='ccptdb1';
ALTER SYSTEM SET FAL_CLIENT = ccptdb2 sid='ccptdb2';
ALTER SYSTEM SET FAL_SERVER = ccptdbdg;

3. DG pfile.ora
ccptdb.__db_cache_size=13354663936
ccptdb.__java_pool_size=67108864
ccptdb.__large_pool_size=67108864
ccptdb.__oracle_base='/u01/product/oracle'#ORACLE_BASE set from environment
ccptdb.__pga_aggregate_target=10536091648
ccptdb.__sga_target=15703474176
ccptdb.__shared_io_pool_size=0
ccptdb.__shared_pool_size=2013265920
ccptdb.__streams_pool_size=0
*.audit_file_dest='/u01/product/oracle/admin/ccptdb/adump'
*.audit_trail='db'
*.cluster_database=false
*.compatible='11.2.0.0.0'
*.control_files='/data/ccptdb/control01.ctl','/data/ccptdb/control02.ctl','/data/ccptdb/control03.ctl'
*.db_block_size=16384
*.db_domain=''
*.db_file_name_convert='+data/ccptdb/datafile/','/data/ccptdb/','+indx/ccptdb/datafile/','/data/ccptdb/'
*.db_name='ccptdb'
*.db_recovery_file_dest='/u01/product/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=5218762752
*.db_unique_name='ccptdbdg'
*.diagnostic_dest='/u01/product/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=ccptdbXDB)'
*.fal_client='ccptdbdg'
*.fal_server='ccptdb1','ccptdb2'
*.local_listener='LISTENER_CCPTDB'
*.log_archive_config='DG_CONFIG=(ccptdb,ccptdbdg)'
*.log_archive_dest_1='LOCATION=/data/ccptdb/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ccptdbdg'
*.log_archive_dest_2='SERVICE=ccptdb LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ccptdb'
*.log_archive_format='%t_%s_%r.arc'
*.log_file_name_convert='+data/ccptdb/onlinelog/','/data/ccptdb/'
*.memory_target=26214400000
*.open_cursors=300
*.processes=1000
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=1105
*.standby_file_management='AUTO'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'

注意備庫設置﹕

*.db_unique_name='ccptdbdg'
*.fal_client='ccptdbdg'
*.fal_server='ccptdb1','ccptdb2'
*.log_archive_config='DG_CONFIG=(ccptdb,ccptdbdg)'
*.log_archive_dest_1='LOCATION=/data/ccptdb1/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=ccptdbdg'
*.log_archive_dest_2='SERVICE=ccptdb LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ccptdb'

alter system set  log_archive_dest_2='SERVICE=ccptdb LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ccptdb';

六.對主庫做一次全備份
在主庫與從庫中建立相同的備份路徑
以oracle用戶登陸

$mkdir –p /data8/backup
$chmod 770 /data8/backup

做一次完整的RMAN熱備份


$rman target/
Rman> backup database format='/data/backup/%U_%s.bak';
Rman>sql"alter system archive log current";
Rman>backup filesperset 10 archivelog all format='/data/backup/%U_%s.bak';

alter database create standby controlfile as '/data/backup/dgcon01.ctl';


七.配置網絡連接

主庫tnsnames.ora

wmrac01<*ccptdb1*/u01/product/oracle/11.2.0/db_1/network/admin>$cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/product/oracle/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

CCPTDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = wmscan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ccptdb)
    )
  )

CCPTDBDG =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.118.253.47)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ccptdbdg)
    )
  )


wmrac02<*ccptdb2*/u01/product/oracle/11.2.0/db_1/network/admin>$cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/product/oracle/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

CCPTDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = wmscan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ccptdb)
    )
  )

CCPTDBDG =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.118.253.47)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ccptdbdg)
    )
  )

備庫listener.ora

ccptdbsty<*ccptdb*/u01/product/oracle/11.2.0/db_1/network/admin>$cat listener.ora
# listener.ora Network Configuration File: /u01/product/oracle/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.118.253.47)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /u01/product/oracle


備庫tnsnames.ora

ccptdbsty<*ccptdb*/u01/product/oracle/11.2.0/db_1/network/admin>$cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/product/oracle/11.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

CCPTDBDG =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 10.118.253.47)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ccptdbdg)
    )
  )

CCPTDB1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.118.253.51)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ccptdb)
      (INSTANCE_NAME = ccptdb1)
    )
  )

CCPTDB2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.118.253.52)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ccptdb)
      (INSTANCE_NAME = ccptdb2)
    )
  )

CCPTDB =
   (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.118.253.51)(PORT = 1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.118.253.52)(PORT = 1521))
      (LOAD_BALANCE = yes)
       (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = ccptdb)
       (FAILOVER_MODE =
           (TYPE = SELECT)
           (METHOD = BASIC)
           (RETRIES = 180)
           (DELAY = 5)
       )
         )
     )

LISTENER_CCPTDB =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.118.253.47)(PORT = 1521))


九.啟動備庫
$sqlplus ‘/as sysdba’
Sql>startup nomount pfile=’/home/oracle/pfile.ora’;
Sql>alter database mount standby database;

采用LGWR進程傳輸日志﹐必須建立備用日志﹐而且日志大小與主庫一樣﹐個數比主庫多一個
首先建立備用日志

SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 111 ('/data/ccptdb/dgredo111a.log','/data/ccptdb/dgredo111b.log') SIZE 50M;

SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 112 ('/data/ccptdb/dgredo112a.log','/data/ccptdb/dgredo112b.log') SIZE 50M;

SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 113 ('/data/ccptdb/dgredo113a.log','/data/ccptdb/dgredo113b.log') SIZE 50M;

SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 114 ('/data/ccptdb/dgredo114a.log','/data/ccptdb/dgredo114b.log') SIZE 50M;

SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 115 ('/data/ccptdb/dgredo115a.log','/data/ccptdb/dgredo115b.log') SIZE 50M;

SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 group 116 ('/data/ccptdb/dgredo116a.log','/data/ccptdb/dgredo116b.log') SIZE 50M;

 

SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 221 ('/data/ccptdb/dgredo221a.log','/data/ccptdb/dgredo221b.log') SIZE 50M;

SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 222 ('/data/ccptdb/dgredo222a.log','/data/ccptdb/dgredo222b.log') SIZE 50M;

SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 223 ('/data/ccptdb/dgredo223a.log','/data/ccptdb/dgredo223b.log') SIZE 50M;

SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 224 ('/data/ccptdb/dgredo224a.log','/data/ccptdb/dgredo224b.log') SIZE 50M;

SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 225 ('/data/ccptdb/dgredo225a.log','/data/ccptdb/dgredo225b.log') SIZE 50M;

SQL>ALTER DATABASE ADD STANDBY LOGFILE THREAD 2 group 226 ('/data/ccptdb/dgredo226a.log','/data/ccptdb/dgredo226b.log') SIZE 50M;


使用RMAN進行恢復
$rman target/
Rman>restore database;
Rman>restore archvielog all;
然后直接進入管理恢復狀態
$sqlplus ‘/as sysdba’
Sql>alter database recover managed standby database disconnect from session;

十.由于主庫為ASM文件系統﹐需要將ASM格式的數據文件轉化為普通文件格式(如果有別名﹐則自動轉換﹐此步是可選項)

alter system set standby_file_management=manual ;

alter database rename file '/data/ccptdb/system.260.744649997' to '/data/ccptdb/system01.dbf' ;
alter database rename file '/data/ccptdb/sysaux.261.744650015' to '/data/ccptdb/sysaux01.dbf' ;
alter database rename file '/data/ccptdb/undotbs1.262.744650027' to '/data/ccptdb/undotbs101.dbf' ;
alter database rename file '/data/ccptdb/undotbs2.264.744650051' to '/data/ccptdb/undotbs201.dbf' ;
alter database rename file '/data/ccptdb/users.265.744650057' to '/data/ccptdb/users01.dbf' ;

為了standby激活后可正常使用需要添加tempfile

alter tablespace temp add tempfile '/data/ccptdb/temp01.dbf' size 2000m;
alter tablespace temp add tempfile '/data/ccptdb/temp02.dbf' size 2000m;

由于ASM格式的數據文件存在﹐在standby開啟后用TOAD無法正常顯示表空間﹐需要刪除以下ASM格式的數據文件

alter database tempfile '+DATA/ccptdb/tempfile/temp.263.744650033' offline;
alter database tempfile '+DATA/ccptdb/tempfile/temp.263.744650033' drop;

alter system set standby_file_management=auto ;


十一.關閉standby﹐重啟并高置為實時運用模式
shutdown immediate
startup
alter database recover managed standby database using current logfile;

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25850100/viewspace-703981/,如需转载,请注明出处,否则将追究法律责任。

下一篇: awr 自動mail
请登录后发表评论 登录
全部评论

注册时间:2011-05-20

  • 博文量
    77
  • 访问量
    98400