亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

RMAN配置DataGuard from Active database with ASM

發布時間:2020-06-18 10:48:06 來源:網絡 閱讀:607 作者:jason_125 欄目:數據庫

一、  環境

主庫:安裝grid軟件及創建磁盤組;安裝數據庫軟件并創建數據庫,

備庫:僅安裝grid軟件并創建asm磁盤組,同時安裝數據庫軟件即可。

 

主機名

數據庫版本

dbname

db_unique_name

ip地址

系統版本

server1(主)

 

oracle11204

 

Jason

 

jason

192.168.1.250

 

rhel6.6_x86_64

server2(備)

jason2

192.168.1.252

二、  主庫配置

1.  確定主數據庫開啟強制LOGGING模式

[oracle@server1 ~]$ sqlplus /nolog

 

SQL*Plus: Release 11.2.0.4.0 Production on Thu Jul 14 20:45:33 2016

 

Copyright (c) 1982, 2013, Oracle. All rights reserved.

 

SQL> conn /as sysdba

Connected.

 

SQL> ALTER DATABASE FORCE LOGGING;

 

Database altered.

 

SQL> select force_logging from v$database;

 

FOR

---

YES

2.  開啟歸檔

SQL> archive log list;

Database log mode             Archive Mode

Automatic archival            Enabled

Archive destination            +DATA

Oldest online log sequence     24

Next log sequence to archive   26

Current log sequence           26

3.  創建standby日志組

1).standby redo log的文件大小與primary 數據庫online redo log 文件大小相同

2).standby redo log日志文件組的個數依照下面的原則進行計算

    Standby redo log組數公式>=(每個instance日志組個數+1)*instance個數

    例如在我的環境中,只有一個節點,這個節點有三組redo,所以

    Standby redo log組數公式>=(3+1)*1  == 4

    所以需要創建4組Standby redo log

3).每一日志組為了安全起見,可以包含多個成員文件。

查看主數據庫的日志組個數與大小,創建standy日志組,大小不能小于在線日志大小。

SQL> select member from v$logfile;

MEMBER

------------------------------------------------------------------------

+DATA/jason/onlinelog/group_3.263.919631585

+DATA/jason/onlinelog/group_2.262.919631583

+DATA/jason/onlinelog/group_1.261.919631583

3 rows selected.

SQL> select group#,bytes/1024/1024 from v$log;

 

    GROUP# BYTES/1024/1024

---------- ---------------

         1              50

         3              50

         2              50

在主數據庫創建standby日志組,位置與原日志組相同的路徑。

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 4 SIZE 50M;

 

Database altered.

 

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 5 SIZE 50M;

 

Database altered.

 

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 6 SIZE 50M;

 

Database altered.

 

SQL> ALTER DATABASE ADD STANDBY LOGFILE GROUP 7 SIZE 50M;

 

Database altered.

 

SQL> select group#,status,type,member from v$logfile;

 

    GROUP# STATUS  TYPE   MEMBER

---------- ------- ------- --------------------------

         3         ONLINE +DATA/jason/onlinelog/group_3.263.919631585

         2         ONLINE +DATA/jason/onlinelog/group_2.262.919631583

         1         ONLINE +DATA/jason/onlinelog/group_1.261.919631583

         4         STANDBY+DATA/jason/onlinelog/group_4.269.919707467

         5         STANDBY+DATA/jason/onlinelog/group_5.270.919707475

         6         STANDBY +DATA/jason/onlinelog/group_6.271.919707483

         7         STANDBY+DATA/jason/onlinelog/group_7.272.919707491

 

7 rows selected.

SQL>

4.  主庫參數文件配置

在主庫上修改dataguard配置相關的各個參數,各參數的具體含義可以參考oracle在線文檔。

alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(JASON,JASON2)' SCOPE=SPFILE;

alter system set STANDBY_FILE_MANAGEMENT='AUTO' SCOPE=SPFILE;

alter system set LOG_ARCHIVE_DEST_1='LOCATION=+DATAVALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=JASON' scope=spfile;

alter system set LOG_ARCHIVE_DEST_2='SERVICE=JASON2 ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)DB_UNIQUE_NAME=JASON2'scope=spfile;

alter system set LOG_ARCHIVE_DEST_STATE_1='ENABLE' scope=spfile;

alter system set LOG_ARCHIVE_DEST_STATE_2='ENABLE' scope=spfile;

alter system set FAL_SERVER='JASON2' scope=spfile;

主庫的DB_UNIQUE_NAME不設置,默認與數據庫名一致。

SQL> alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(JASON,JASON2)'SCOPE=SPFILE;

 

System altered.

 

SQL> alter system set STANDBY_FILE_MANAGEMENT='AUTO' SCOPE=SPFILE;

 

System altered.

 

SQL> alter system set LOG_ARCHIVE_DEST_1='LOCATION=+DATAVALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=JASON' scope=spfile;

 

System altered.

 

SQL> alter system set LOG_ARCHIVE_DEST_2='SERVICE=JASON2 ASYNCVALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=JASON2'scope=spfile;

 

System altered.

 

SQL> alter system set LOG_ARCHIVE_DEST_STATE_1='ENABLE' scope=spfile;

 

System altered.

 

SQL> alter system set LOG_ARCHIVE_DEST_STATE_2='ENABLE' scope=spfile;

 

System altered.

 

SQL> alter system set FAL_SERVER='JASON2' scope=spfile;

 

System altered.

 

SQL>

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

 

Total System Global Area 409194496 bytes

Fixed Size                 2253744 bytes

Variable Size             310381648bytes

Database Buffers          92274688 bytes

Redo Buffers               4284416 bytes

Database mounted.

Database opened.

5.  配置監聽及tnsname

grid用戶創建監聽,如下:

[grid@server1 ~]$ cd /u01/app/11.2.0/grid/network/admin/

[grid@server1 admin]$ cat listener.ora

# listener.ora Network Configuration File:/u01/app/11.2.0/grid/network/admin/listener.ora

# Generated by Oracle configuration tools.

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL =IPC)(KEY = EXTPROC1521))

      (ADDRESS = (PROTOCOL =TCP)(HOST = server1)(PORT = 1521))

    )

  )

 

ADR_BASE_LISTENER = /u01/app/grid

 

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON              # line added by Agent

oracle用戶下tnsname.ora配置如下

[oracle@server1 ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/

[oracle@server1 admin]$ cat tnsnames.ora

# tnsnames.ora Network Configuration File:/u01/app/11.2.0/grid/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

 

JASON =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL =TCP)(HOST = 192.168.1.250)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = JASON)

    )

  )

 

JASON2 =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL =TCP)(HOST = 192.168.1.252)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = JASON2)

    )

  )

 

[oracle@server1 admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-AUG-201622:43:25

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNRfor Linux: Version 11.2.0.4.0 - Production

Start Date               12-AUG-2016 17:56:24

Uptime                    0 days 4 hr. 47 min. 0 sec

Trace Level               off

Security                  ON:Local OS Authentication

SNMP                      OFF

Listener Parameter File  /u01/app/11.2.0/grid/network/admin/listener.ora

Listener Log File         /u01/app/grid/diag/tnslsnr/server1/listener/alert/log.xml

Listening Endpoints Summary...

 (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=server1)(PORT=1521)))

Services Summary...

Service "+ASM" has 1 instance(s).

  Instance "+ASM",status READY, has 1 handler(s) for this service...

Service "JASON" has 1 instance(s).

  Instance "JASON",status READY, has 1 handler(s) for this service...

Service "JASONXDB" has 1 instance(s).

  Instance "JASON",status READY, has 1 handler(s) for this service...

The command completed successfully

[oracle@server1 admin]$

6.  生成pfile文件,同步相應文件至備庫

在主數據庫生成pfile文件。

SQL> create pfile=’/home/oracle/pfile.ora’ from spfile;

File created.

同步密碼認證文件至備機。

[oracle@jason1 dbs]$ pwd

/u01/app/oracle/product/11.2.0/dbhome_1/dbs

[oracle@jason1 dbs]$ scp initJASON.ora orapwJASON 192.168.1.252:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/

The authenticity of host '192.168.1.100 (192.168.1.100)' can't beestablished.

RSA key fingerprint is 25:ca:65:90:d3:30:fa:68:ed:11:64:b2:0e:b0:39:a7.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.1.100' (RSA) to the list of knownhosts.

oracle@192.168.1.252's password:   

initJASON.ora                                                                                       100%1415     1.4KB/s   00:00  

orapwJASON                                                                                          100% 1536     1.5KB/s   00:00      

[oracle@jason1 dbs]

三、  備庫配置

7.  創建對應目錄

備庫上創建相關目錄

[oracle@server2 oracle]$ mkdir -p /u01/app/oracle/admin/JASON2/adump

8.  備庫參數文件配置

備庫上修改初始參數文件,配置DG所需參數如下。

JASON.__db_cache_size=104857600

JASON.__java_pool_size=4194304

JASON.__large_pool_size=8388608

JASON.__pga_aggregate_target=180355072

JASON.__sga_target=230686720

JASON.__shared_io_pool_size=0

JASON.__shared_pool_size=104857600

JASON.__streams_pool_size=0

*.audit_file_dest='/u01/app/oracle/admin/JASON2/adump'

*.audit_trail='db'

*.compatible='11.2.0.4.0'

*.control_files='+DATA'

*.db_block_size=8192

*.db_create_file_dest='+DATA'

*.db_domain=''

*.db_name='JASON'

*.DB_UNIQUE_NAME='JASON2'

*.diagnostic_dest='/u01/app/oracle'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=JASONXDB)'

*.fal_server='JASON'

*.log_archive_config='DG_CONFIG=(JASON,JASON2)'

*.log_archive_dest_1='LOCATION=+DATA VALID_FOR=(ALL_LOGFILES,ALL_ROLES)DB_UNIQUE_NAME=JASON2'

*.log_archive_dest_2='SERVICE=JASON ASYNCVALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=JASON'

*.log_archive_dest_state_1='ENABLE'

*.log_archive_dest_state_2='ENABLE'

*.log_archive_format='%t_%s_%r.dbf'

*.memory_target=411041792

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.standby_file_management='AUTO'

*.undo_tablespace='UNDOTBS1'

9.配置監聽                                                                                

grid用戶創建監聽,備庫監聽必須配置為靜態監聽。如下:

[grid@server2 admin]$ cat listener.ora

# listener.ora Network Configuration File:/u01/app/11.2.0/grid/network/admin/listener.ora

# Generated by Oracle configuration tools.

 

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = JASON2)

      (ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1)

      (SID_NAME = JASON)

    )

  )

 

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL =IPC)(KEY = EXTPROC1521))

    )

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL =TCP)(HOST = server2)(PORT = 1521))

    )

  )

 

ADR_BASE_LISTENER = /u01/app/grid

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON

oracle用戶下tnsname.ora配置如下

[oracle@server1 ~]$ cd/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/

[oracle@server1 admin]$ cat tnsnames.ora

# tnsnames.ora Network Configuration File:/u01/app/11.2.0/grid/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

 

JASON =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL =TCP)(HOST = 192.168.1.250)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = JASON)

    )

  )

 

JASON2 =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL =TCP)(HOST = 192.168.1.252)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = JASON2)

    )

  )

10.創建備庫

將備庫啟動到nomount狀態,然后在備機連接主庫進行duplicate操作。

[oracle@server2 dbs]$ rman target sys/system@JASON auxiliarysys/system@JASON2

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Aug 12 18:35:212016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: JASON (DBID=2143845850)

connected to auxiliary database: JASON (not mounted)

RMAN> duplicate target database for standby nofilenamecheck fromactive database;

Starting Duplicate Db at 12-AUG-16

using target database control file instead of recovery catalog

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: SID=23 device type=DISK

 

contents of Memory Script:

{

   backup as copy reuse

   targetfile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwJASON' auxiliaryformat

 '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwJASON'   ;

}

executing Memory Script

 

Starting backup at 12-AUG-16

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=45 device type=DISK

Finished backup at 12-AUG-16

 

contents of Memory Script:

{

   backup as copy currentcontrolfile for standby auxiliary format '+DATA/jason2/controlfile/current.256.919708533';

   sql clone "create spfilefrom memory";

   shutdown clone immediate;

   startup clone nomount;

   sql clone "alter systemset  control_files =

 ''+DATA/jason2/controlfile/current.256.919708533'' comment=

 ''Set by RMAN''scope=spfile";

   shutdown clone immediate;

   startup clone nomount;

}

executing Memory Script

 

Starting backup at 12-AUG-16

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

copying standby control file

output filename=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_JASON.ftag=TAG20160812T183533 RECID=1 STAMP=919708533

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03

Finished backup at 12-AUG-16

 

sql statement: create spfile from memory

 

Oracle instance shut down

 

connected to auxiliary database (not started)

Oracle instance started

 

Total System Global Area    409194496 bytes

 

Fixed Size                    2253744 bytes

Variable Size               318770256 bytes

Database Buffers              83886080 bytes

Redo Buffers                  4284416 bytes

 

sql statement: alter system set control_files =  ''+DATA/jason2/controlfile/current.256.919708533'' comment= ''Set byRMAN'' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)

Oracle instance started

Total System Global Area    409194496 bytes

Fixed Size                    2253744 bytes

Variable Size               318770256 bytes

Database Buffers             83886080 bytes

Redo Buffers                   4284416 bytes

 

contents of Memory Script:

{

   sql clone 'alter database mountstandby database';

}

executing Memory Script

 

sql statement: alter database mount standby database

 

contents of Memory Script:

{

   set newname for clonetempfile  1 to new;

   switch clone tempfile all;

   set newname for clonedatafile  1 to new;

   set newname for clonedatafile  2 to new;

   set newname for clonedatafile  3 to new;

   set newname for clonedatafile  4 to new;

   backup as copy reuse

   datafile  1 auxiliary format new

   datafile  2 auxiliary format new

   datafile  3 auxiliary format new

   datafile  4 auxiliary format new

   ;

   sql 'alter system archive logcurrent';

}

executing Memory Script

 

executing command: SET NEWNAME

 

renamed tempfile 1 to +DATA in control file

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

Starting backup at 12-AUG-16

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile copy

input datafile file number=00001name=+DATA/jason/datafile/system.256.919631481

output file name=+DATA/jason2/datafile/system.257.919708567tag=TAG20160812T183605

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35

channel ORA_DISK_1: starting datafile copy

input datafile file number=00002name=+DATA/jason/datafile/sysaux.257.919631481

output file name=+DATA/jason2/datafile/sysaux.258.919708603tag=TAG20160812T183605

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:25

channel ORA_DISK_1: starting datafile copy

input datafile file number=00003name=+DATA/jason/datafile/undotbs1.258.919631481

output file name=+DATA/jason2/datafile/undotbs1.259.919708627tag=TAG20160812T183605

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03

channel ORA_DISK_1: starting datafile copy

input datafile file number=00004name=+DATA/jason/datafile/users.259.919631483

output file name=+DATA/jason2/datafile/users.260.919708631tag=TAG20160812T183605

channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01

Finished backup at 12-AUG-16

 

sql statement: alter system archive log current

 

contents of Memory Script:

{

   switch clone datafile all;

}

executing Memory Script

 

datafile 1 switched to datafile copy

input datafile copy RECID=1 STAMP=919708632 filename=+DATA/jason2/datafile/system.257.919708567

datafile 2 switched to datafile copy

input datafile copy RECID=2 STAMP=919708632 filename=+DATA/jason2/datafile/sysaux.258.919708603

datafile 3 switched to datafile copy

input datafile copy RECID=3 STAMP=919708633 filename=+DATA/jason2/datafile/undotbs1.259.919708627

datafile 4 switched to datafile copy

input datafile copy RECID=4 STAMP=919708633 filename=+DATA/jason2/datafile/users.260.919708631

Finished Duplicate Db at 12-AUG-16

RMAN>

備注:創建備庫后,數據庫處于mount狀態,數據打開時將會初始化臨時表空間、在線日志、standby日志。

11.開啟ADG

將備庫置于active dataguard模式下,備庫創建成功后默認為mount狀態,需要手動打開。

[oracle@server2 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 12 18:51:54 2016

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bitProduction

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

 

SQL> alter database open;

 

Database altered.

 

SQL> alter database recover managed standby database using currentlogfile disconnect from session;

 

Database altered.

 

SQL> select open_mode,database_role,db_unique_name from v$database;

 

OPEN_MODE            DATABASE_ROLE    DB_UNIQUE_NAME

-------------------- ---------------- ------------------------------

READ ONLY WITH APPLY PHYSICAL STANDBY JASON2

 

SQL> select protection_mode,protection_level from v$database;

 

PROTECTION_MODE     PROTECTION_LEVEL

-------------------- --------------------

MAXIMUM PERFORMANCE  MAXIMUMPERFORMANCE

 

SQL>

 

SQL> select status from v$standby_log;

 

STATUS

----------

UNASSIGNED

ACTIVE

UNASSIGNED

UNASSIGNED

 

SQL> select group#,status,type,member from v$logfile;

 

    GROUP# STATUS  TYPE   MEMBER

---------- ------- ------- --------------------------

         3         ONLINE +DATA/jason2/onlinelog/group_3.263.919708637

         2         ONLINE +DATA/jason2/onlinelog/group_2.262.919708637

         1         ONLINE +DATA/jason2/onlinelog/group_1.261.919708633

         4         STANDBY+DATA/jason2/onlinelog/group_4.264.919708637

         5         STANDBY+DATA/jason2/onlinelog/group_5.265.919708639

         6         STANDBY+DATA/jason2/onlinelog/group_6.266.919708639

         7        STANDBY +DATA/jason2/onlinelog/group_7.267.919708641

 

7 rows selected.

 

SQL>

主庫查看數據庫狀態

[oracle@server1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Aug 12 18:34:16 2016

 

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bitProduction

With the Partitioning, Automatic Storage Management, OLAP, Data Mining

and Real Application Testing options

SQL> select open_mode,database_role,db_unique_name from v$database;

 

OPEN_MODE           DATABASE_ROLE    DB_UNIQUE_NAME

-------------------- ---------------- ------------------------------

READ WRITE           PRIMARY          JASON

 

SQL> select protection_mode,protection_level from v$database;

 

PROTECTION_MODE     PROTECTION_LEVEL

-------------------- --------------------

MAXIMUM PERFORMANCE  MAXIMUMPERFORMANCE

 

SQL>

12.創建spfile文件

備庫創建結束后,需要創建spfile文件。

修改pfile文件control_files參數,指定備庫的控制文件,查看asm磁盤組獲取控制文件名及位置。如下:

control_files='+DATA/jason2/controlfile/current.256.919708533'

創建spfile.

SQL> create SPFILE='+DATA/JASON2/spfileJASON.ora'from pfile='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initJASON.ora';

File created.

創建pfile文件指向

[oracle@server2dbs]$ cat initJASON.ora

SPFILE='+DATA/JASON2/spfileJASON.ora'

[oracle@server2dbs]$

spfile文件創建成功后,備庫重啟將使用spfile文件啟動數據庫

使用ALTERDATABASE RECOVER MANAGED STANDBY DATABASE CANCEL取消日志恢復,關閉數據庫,再次打開,再開啟日志應用。

SQL> showparameter spfile

 

NAME                                 TYPE        VALUE

----------------------------------------------- ------------------------------

spfile                               string      +DATA/jason2/spfilejason.ora

SQL>

四、  測試

13.主備庫查看日志

主庫切換日志

SQL> alter system switch logfile;

 

System altered.

 

SQL> /

 

System altered.

 

SQL> /

 

System altered.

 

SQL> SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOGORDER BY SEQUENCE#;

 

 SEQUENCE# APPLIED

---------- ---------

         5 NO

         6 NO

         7 NO

         8 NO

         9 NO

        10 NO

        10 YES

        11 NO

        11 YES

        12 NO

        12 YES

 

 SEQUENCE# APPLIED

---------- ---------

        13 NO

        13 YES

        14 NO

        14 YES

        15 NO

        15 NO

 

17 rows selected.

SQL>

備庫查看日志

SQL>  SELECTSEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;

 

 SEQUENCE# APPLIED

---------- ---------

        10 YES

        11 YES

        12 YES

        13 YES

        14 YES

        15IN-MEMORY

 

6 rows selected.

SQL>

14.switch_over測試

主庫切換

SQL> SELECTSWITCHOVER_STATUS FROM V$DATABASE;

 

SWITCHOVER_STATUS

--------------------

TO STANDBY

 

SQL> ALTERDATABASE COMMIT TO SWITCHOVER TO PHYSICAL STANDBY WITH SESSION SHUTDOWN;

 

Database altered.

 

SQL> startup

ORACLE instancestarted.

 

Total System GlobalArea  409194496 bytes

Fixed Size                  2253744 bytes

Variable Size             322964560 bytes

DatabaseBuffers           79691776 bytes

Redo Buffers                4284416 bytes

Database mounted.

Database opened.

SQL> selectopen_mode,database_role,db_unique_name from v$database;

 

OPEN_MODE            DATABASE_ROLE    DB_UNIQUE_NAME

------------------------------------ ------------------------------

READ ONLY            PHYSICAL STANDBY JASON

 

 

SQL> ALTERDATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROMSESSION;

 

Database altered.

 

SQL>                   

 

備庫切換

SQL> SELECTSWITCHOVER_STATUS FROM V$DATABASE;

 

SWITCHOVER_STATUS

--------------------

TO PRIMARY

 

SQL> ALTERDATABASE COMMIT TO SWITCHOVER TO PRIMARY WITH SESSION SHUTDOWN;

 

Database altered.

 

SQL> selectopen_mode,database_role,db_unique_name from v$database;

 

OPEN_MODE            DATABASE_ROLE    DB_UNIQUE_NAME

------------------------------------ ------------------------------

MOUNTED              PRIMARY          JASON2

 

SQL> alterdatabase open;

 

Database altered.

 

SQL> selectopen_mode,database_role,db_unique_name from v$database;

 

OPEN_MODE            DATABASE_ROLE    DB_UNIQUE_NAME

------------------------------------ ------------------------------

READ WRITE           PRIMARY          JASON2

 

SQL>

五、  報錯處理

15.報錯1

[oracle@server2 ~]$rman  target sys/system@JASON auxiliarysys/system@jason2

Recovery Manager:Release 11.2.0.4.0 - Production on Wed Aug 10 07:37:33 2016

Copyright (c) 1982,2011, Oracle and/or its affiliates.  Allrights reserved.

 

connected to target database:JASON (DBID=2143699214)

connected toauxiliary database: JASON (not mounted)

 

RMAN> duplicatetarget database for standby nofilenamecheck from active database;

 

Starting DuplicateDb at 10-AUG-16

using targetdatabase control file instead of recovery catalog

allocated channel:ORA_AUX_DISK_1

channelORA_AUX_DISK_1: SID=22 device type=DISK

 

contents of MemoryScript:

{

   backup as copy reuse

   targetfile '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwJASON' auxiliaryformat

 '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwJASON'   ;

}

executing MemoryScript

 

Starting backup at10-AUG-16

allocated channel:ORA_DISK_1

channel ORA_DISK_1:SID=51 device type=DISK

Finished backup at10-AUG-16

 

contents of MemoryScript:

{

   backup as copy current controlfile forstandby auxiliary format  '+DATA/jason2/controlfile/current.256.919708533';

}

executing MemoryScript

 

Starting backup at10-AUG-16

using channelORA_DISK_1

channel ORA_DISK_1:starting datafile copy

copying standby controlfile

RMAN-00571:===========================================================

RMAN-00569:=============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571:===========================================================

RMAN-03002: failureof Duplicate Db command at 08/10/2016 07:38:20

RMAN-05501: abortingduplication of target database

RMAN-03015: erroroccurred in stored script Memory Script

RMAN-03009: failureof backup command on ORA_DISK_1 channel at 08/10/2016 07:38:20

ORA-17628: Oracleerror 19505 returned by remote Oracle server

RMAN>

錯誤分析:該錯誤mos也給出了對應解決方法,由于主備庫目錄不一致未使用參數db_file_name_convert,LOG_FILE_NAME_CONVERT參數導致。本案例中主備庫都是用+data磁盤組,同時使用OMF管理文件。因此不適用本案例。在創建數據庫期間,警告日志報如下錯誤:

ORA-15025: could not open disk"/dev/asm-diskb"

ORA-27041: unable to open file

Linux-x86_64 Error: 13: Permissiondenied

Additional information: 9

Wed Aug 10 07:38:19 2016

SUCCESS: diskgroup DATA wasdismounted

ERROR: diskgroup DATA was notmounted

Errors in file/u01/app/oracle/diag/rdbms/jason2/JASON/trace/JASON_ora_3131.trc:

ORA-19505:failed to identify file "+DATA/jason2/controlfile/current.256.919708533"

ORA-17502:ksfdcre:3 Failed to create file +DATA/jason2/controlfile/current.256.919708533

ORA-15001: diskgroup"DATA" does not exist or is not mounted

ORA-15040: diskgroup is incomplete

備庫磁盤組存在,且查看主庫磁盤組與備庫磁盤組權限一致,那么可能是其他原因導致。最終發現主庫的/u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle文件權限不一致。

主庫

[root@server1 bin]# ll oracle

-rwsr-s--x 1 oracle asmadmin239626731 Aug 11 20:06 oracle

備庫

[root@server2 bin]# ll oracle

-rwsr-s--x 1 oracle oinstall239626731 Aug 11 20:06 oracle

主備庫唯一的區別在于備庫是通過rman復制創建。測試發現在dbca創建數據庫后將會修改該文件權限。以下為測試過程:

安裝grid,數據庫軟件時,未創建數據庫時

[root@server1 dbhome_1]# cd bin/

[root@server1 bin]# ll oracle

-rwsr-s--x 1 oracle oinstall239626731 Aug 11 20:06 oracle

[root@server1 bin]#

dbca創建數據庫之后

[root@server1 trace]# cd/u01/app/oracle/product/11.2.0/dbhome_1/bin/

[root@server1 bin]# ll oracle

-rwsr-s--x 1 oracle asmadmin239626731 Aug 11 20:06 oracle

[root@server1 bin]#

因此修改備庫該文件權限,問題解決。

[root@server2 bin]#chown oracle:asmadminoracle

[root@server2 bin]#chmod 6751 oracle

[root@server2 bin]# ll oracle

-rwsr-s--x 1 oracle asmadmin239626731 Aug 11 20:06 oracle

16.報錯2

備用數據庫啟動時報如下錯誤

ERROR: failed to establish dependency between database JASON2 anddiskgroup resource ora.DATA.dg

查看噶日志信息是因為備庫未注冊入CRS啟動時報錯。同時備機重啟僅ASM實例與crs啟動,CRS無法啟動數據庫。因此注冊備庫至CRS中。

以oracle用戶執行

[oracle@server2 dbs]$ srvctl add database -d JASON2 -o/u01/app/oracle/product/11.2.0/dbhome_1 -p +DATA/JASON2/spfileJASON.ora -i jason -r PHYSICAL_STANDBY -n jason

[oracle@server2 dbs]$ srvctl modify database -d JASON2 -a 'data'

[oracle@server2 dbs]$ srvctl config database -d jason2 -a

Database unique name: JASON2

Database name: jason

Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1

Oracle user: oracle

Spfile: +DATA/JASON2/spfileJASON.ora

Domain:

Start options: open

Stop options: immediate

Database role: PHYSICAL_STANDBY

Management policy: AUTOMATIC

Database instance: jason

Disk Groups: DATA

Services:

Database is enabled

[oracle@server2 dbs]$

 


向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

墨玉县| 东海县| 大英县| 德安县| 乐清市| 佛冈县| 微山县| 乌审旗| 长顺县| 沽源县| 寿光市| 金湖县| 施甸县| 通海县| 舟曲县| 乡宁县| 连云港市| 铜梁县| 大化| 昌黎县| 根河市| 奎屯市| 石棉县| 米泉市| 湟中县| 樟树市| 灌南县| 永宁县| 巫山县| 绥化市| 荃湾区| 化州市| 达拉特旗| 客服| 永福县| 曲沃县| 大竹县| 朔州市| 北碚区| 定边县| 东宁县|