日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

oracle 12 ORA-01262,oracle物理dg安装:方法二

發(fā)布時間:2023/12/13 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle 12 ORA-01262,oracle物理dg安装:方法二 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

本文記錄了物理dg的第二種安裝方法,使用rman?duplicate?from active database,不需要做備份文件。

準(zhǔn)備工作:

1.兩臺虛擬機(jī),主機(jī)名:n1, n2,操作系統(tǒng):centos6.7,建好信任關(guān)系

2.oracle database 11.2.0.4軟件已裝好

3.節(jié)點(diǎn)1(n1)數(shù)據(jù)庫創(chuàng)建好,db_name=orcl,db_unique_name=dg1,

歸檔模式(歸檔目錄/oracle/arc/)

4.變量

n1變量: export ORACLE_SID=dg1 export ORACLE_BASE=/oracle/db export ORACLE_HOME=$ORACLE_BASE/ora11g export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib export PATH=$PATH:$ORACLE_HOME/bin n2變量: export ORACLE_SID=dg2 export ORACLE_BASE=/oracle/db export ORACLE_HOME=$ORACLE_BASE/ora11g export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib export PATH=$PATH:$ORACLE_HOME/bin

5.tns文件內(nèi)容($ORACLE_BASE/network/admin),n1、n2都需要

# tnsnames.ora Network Configuration File: /oracle/db/ora11g/network/admin/tnsnames.ora # Generated by Oracle configuration tools. dg1 = ? (DESCRIPTION = ? ? (ADDRESS_LIST = ? ? ? (ADDRESS = (PROTOCOL = TCP)(HOST = n1)(PORT = 1521)) ? ? ) ? ? (CONNECT_DATA = ? ? ? (SERVICE_NAME = dg1) ? ? ) ? ) dg2 = ? (DESCRIPTION = ? ? (ADDRESS_LIST = ? ? ? (ADDRESS = (PROTOCOL = TCP)(HOST = n2)(PORT = 1521)) ? ? ) ? ? (CONNECT_DATA = ? ? ? (SERVICE_NAME = dg2) ? ? ) ? )

6.靜態(tài)listener($ORACLE_BASE/network/admin/listener.ora),主備庫最好都設(shè)置

n1:

# listener.ora Network Configuration File: /oracle/db/ora11g/network/admin/listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = ? (SID_LIST = ? ? (SID_DESC = ? ? ? (GLOBAL_DBNAME = dg1) ? ? ? (ORACLE_HOME = /oracle/db/ora11g) ? ? ? (SID_NAME = dg1) ? ? ) ? ) LISTENER = ? (DESCRIPTION = ? ? (ADDRESS = (PROTOCOL = TCP)(HOST = n1)(PORT = 1521)) ? )

n2:

# listener.ora Network Configuration File: /oracle/db/ora11g/network/admin/listener.ora # Generated by Oracle configuration tools. SID_LIST_LISTENER = ? (SID_LIST = ? ? (SID_DESC = ? ? ? (GLOBAL_DBNAME = dg2) ? ? ? (ORACLE_HOME = /oracle/db/ora11g) ? ? ? (SID_NAME = dg2) ? ? ) ? ) LISTENER = ? (DESCRIPTION = ? ? (ADDRESS = (PROTOCOL = TCP)(HOST = n2)(PORT = 1521)) ? )

1.主庫創(chuàng)建pfile

create pfile='/tmp/init.ora' from spfile;

2.將上一步生成的pfile及主庫的 密碼文件 scp 到備庫(注意備庫上 密碼文件 的名稱)

scp /tmp/init.ora oracle@n2:/tmp scp $ORACLE_HOME/dbs/orapwdg1 oracle@n2:$ORACLE_HOME/dbs/orapwdg2

3.備庫創(chuàng)建spfile

create spfile from pfile='/tmp/init.ora';

4.備庫啟動到nomount

startup nomount

5.備庫修改參數(shù),并重啟到nomount

alter system set db_unique_name=dg2 scope=spfile; alter system set log_archive_config='DG_CONFIG=(dg1,dg2)' scope=spfile; alter system set log_archive_dest_1='LOCATION=/oracle/arc/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dg2' scope=spfile; alter system set fal_server=dg1 scope=spfile; alter system set fal_client=dg2 scope=spfile; alter system set standby_file_management=auto scope=spfile; alter system set service_names='dg2' scope=spfile;

startup nomount force

6.備庫執(zhí)行rman(rman target sys/sys@dg1 auxiliary sys/sys@dg2)

duplicate target database for standby nofilenamecheck from active database;

7.備庫增加standby日志(主庫也需要加,如果在duplicate之前主庫已經(jīng)添加了standby,這時備庫可能需要刪除再重建standby)

alter database add standby logfile group 4 ('/oracle/db/oradata/orcl/sredo41.log','/oracle/db/oradata/orcl/sredo42.log') size 50M; alter database add standby logfile group 5 ('/oracle/db/oradata/orcl/sredo51.log','/oracle/db/oradata/orcl/sredo52.log') size 50M; alter database add standby logfile group 6 ('/oracle/db/oradata/orcl/sredo61.log','/oracle/db/oradata/orcl/sredo62.log') size 50M;

8.dg創(chuàng)建完成,檢查是否正常(檢查方法參見 oracle物理dg安裝:方法一)

注:

可能會出現(xiàn)的錯誤

1.備庫啟動到nomount

--db_recovery_file_dest參數(shù)對應(yīng)的目錄(/oracle/db/fast_recovery_area,具體值查看/tmp/init.ora文件)沒有創(chuàng)建會報以下錯,需要手動創(chuàng)建

SQL> startup nomount ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated ORA-01262: Stat failed on a file destination directory Linux-x86_64 Error: 2: No such file or directory SQL> host [oracle@n2 tmp]$?mkdir -p /oracle/db/fast_recovery_area [oracle@n2 tmp]$ exit exit --audit_file_dest參數(shù)對應(yīng)的目錄(/oracle/db/admin/orcl/adump,具體值查看/tmp/init.ora文件)沒有創(chuàng)建會報以下錯,需要手動創(chuàng)建(創(chuàng)建后需要退出sqlplus重新登錄) SQL> startup nomount ORA-09925: Unable to create audit trail file Linux-x86_64 Error: 2: No such file or directory Additional information: 9925 SQL> host [oracle@n2 tmp]$?mkdir -p /oracle/db/admin/orcl/adump [oracle@n2 tmp]$ exit exit SQL> select status from v$instance; select status from v$instance * ERROR at line 1: ORA-01012: not logged on Process ID: 0 Session ID: 0 Serial number: 0 SQL> startup nomount ORA-01012: not logged on SQL> exit Disconnected [oracle@n2 tmp]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue Apr 12 13:47:34 2016 Copyright (c) 1982, 2013, Oracle. ?All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select status from v$instance; STATUS ------------------------------------ STARTED SQL> shutdown immediate ORA-01507: database not mounted ORACLE instance shut down. SQL> startup nomount ORACLE instance started. Total System Global Area ?839282688 bytes Fixed Size ? ? ? ? ? ? ? ? ?2257880 bytes Variable Size ? ? ? ? ? ? 545262632 bytes Database Buffers ? ? ? ? ?289406976 bytes Redo Buffers ? ? ? ? ? ? ? ?2355200 bytes

2.備庫執(zhí)行rman(rman target sys/sys@dg1 auxiliary sys/sys@dg2)

--控制文件,數(shù)據(jù)文件 所在目錄要存在,否則備庫duplicate會報錯,手動創(chuàng)建好對應(yīng)目錄,重新執(zhí)行duplicate繼續(xù)進(jìn)行

contents of Memory Script:

{ ? ?backup as copy current controlfile for standby auxiliary format ?'/oracle/db/oradata/orcl/control01.ctl'; ? ?restore clone controlfile to ?'/oracle/db/oradata/orcl/control02.ctl' from? ?'/oracle/db/oradata/orcl/control01.ctl'; } executing Memory Script Starting backup at 11-APR-16 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy copying standby control file RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of Duplicate Db command at 04/11/2016 18:41:11 RMAN-05501: aborting duplication of target database RMAN-03015: error occurred in stored script Memory Script RMAN-03009: failure of backup command on ORA_DISK_1 channel at 04/11/2016 18:41:11 ORA-17628: Oracle error 19505 returned by remote Oracle server

3.備庫執(zhí)行rman(rman target sys/sys@dg1 auxiliary sys/sys@dg2)

--主庫rman檢查是不是有expired的歸檔日志等,有的話需要先crosscheck、delete掉(然后備庫要退出rman重新登,再執(zhí)行duplicate),否則備庫dupliate會報錯 Starting backup at 11-APR-16 using channel ORA_DISK_1 channel ORA_DISK_1: starting datafile copy copying standby control file output file name=/oracle/db/ora11g/dbs/snapcf_dg1.f tag=TAG20160411T184405 RECID=11 STAMP=908909046 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01 Finished backup at 11-APR-16 Starting restore at 11-APR-16 using channel ORA_AUX_DISK_1 DBGSQL: ? ? TARGET> begin :fhdbi := dbms_rcvcat.getDbid; end; DBGSQL: ? ? ? ?sqlcode = 6550 DBGSQL: ? ? ? ? B :fhdbi = 32767 RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of Duplicate Db command at 04/11/2016 18:44:06 RMAN-05501: aborting duplication of target database RMAN-03015: error occurred in stored script Memory Script ORA-06550: line 1, column 17: PLS-00201: identifier 'DBMS_RCVCAT.GETDBID' must be declared ORA-06550: line 1, column 7: PL/SQL: Statement ignored

檢查及刪除過期expired日志的命令

crosscheck archivelog all;

list expired archivelog all;

delete expired archivelog all;

總結(jié)

以上是生活随笔為你收集整理的oracle 12 ORA-01262,oracle物理dg安装:方法二的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。