namedhao 发表于 2018-9-25 09:21:08

oracle dataguard-linuxart

  主库10.1.1.130    备库10.1.1.179
  ======================================
  主库
  $ echo $ORACLE_SID
  orcl
  $ sqlplus / as sysdba

  SQL*Plus:>  Copyright (c) 1982, 2007, Oracle.All Rights Reserved.
  Connected to:

  Oracle Database 10g Enterprise Edition>  With the Partitioning, OLAP, Data Mining and Real Application Testing options
  SQL> shutdown immediate
  Database closed.
  Database dismounted.
  ORACLE instance shut down.
  SQL> startup mount
  ORACLE instance started.
  Total System Global Area603979776 bytes

  Fixed>
  Variable>  Database Buffers          432013312 bytes
  Redo Buffers                7118848 bytes
  Database mounted.

  SQL>>
  Database>
  SQL>>
  Database>
  SQL>>
  System>
  SQL>>
  Database>  SQL> archive log list
  Database log mode            Archive Mode
  Automatic archival             Enabled
  Archive destination            /archive/
  Oldest online log sequence   1
  Next log sequence to archive   1
  Current log sequence         1
  SQL> select force_logging from v$database;
  FOR
  ---
  YES
  SQL> create pfile='$ORACLE_HOME/dbs/initorcl.ora' from spfile;
  File created.
  SQL> shutdown immediate
  Database closed.
  Database dismounted.
  ORACLE instance shut down.
  SQL> exit

  Disconnected from Oracle Database 10g Enterprise Edition>  With the Partitioning, OLAP, Data Mining and Real Application Testing options
  $ vim $ORACLE_HOME/dbs/initorcl.ora
  $ tail -8 !$
  tail -8 $ORACLE_HOME/dbs/initorcl.ora
  db_unique_name=pdb
  log_archive_config='dg_config=(pdb,sdb)'
  fal_server=sdb
  fal_client=pdb
  log_archive_dest_2='service=sdb lgwr sync affirm valid_for=(online_logfile,primary_role) db_unique_name=sdb'
  log_archive_dest_state_1=ENABLE
  log_archive_dest_state_2=ENABLE
  standby_file_management=AUTO
  $ /etc/init.d/iptables status
  Firewall is stopped.
  $ sqlplus / as sysdba

  SQL*Plus:>  Copyright (c) 1982, 2007, Oracle.All Rights Reserved.

  Connected to an>  SQL> startup nomount pfile='$ORACLE_HOME/dbs/initorcl.ora'
  ORACLE instance started.
  Total System Global Area603979776 bytes

  Fixed>
  Variable>  Database Buffers          432013312 bytes
  Redo Buffers                7118848 bytes
  SQL> create spfile from pfile;
  File created.

  SQL>>
  Database>
  SQL>>
  Database>  SQL> select instance_name from v$instance;
  INSTANCE_NAME
  ----------------
  orcl
  SQL> select name from v$database;
  NAME
  ---------
  ORCL
  配置监听
  图主库监听
  $ cd /oracle/10g/network/admin/
  $ more listener.ora
  # listener.ora Network Configuration File: /oracle/10g/network/admin/listener.or
  a
  # Generated by Oracle configuration tools.
  SID_LIST_LISTENER =
  (SID_LIST =
  (SID_DESC =
  (GLOBAL_DBNAME = orcl)
  (ORACLE_HOME = /oracle/10g)
  (SID_NAME = orcl)
  )
  )
  LISTENER =
  (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = aa.ly.com)(PORT = 1521))
  )
  $ more tnsnames.ora
  # tnsnames.ora Network Configuration File: /oracle/10g/network/admin/tnsnames.or
  a
  # Generated by Oracle configuration tools.
  PDB =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.130)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SERVICE_NAME = pdb)
  )
  )
  SDB =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.179)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SERVICE_NAME = sdb)
  )
  )
  开启监听
  $ lsnrctl start
  LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 11-JUL-2011 19:15:53
  Copyright (c) 1991, 2007, Oracle.All rights reserved.
  Starting /oracle/10g/bin/tnslsnr: please wait...
  TNSLSNR for Linux: Version 10.2.0.4.0 - Production
  System parameter file is /oracle/10g/network/admin/listener.ora
  Log messages written to /oracle/10g/network/log/listener.log
  Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=aa.ly.com)(PORT=1521)))
  Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=aa.ly.com)(PORT=1521)))
  STATUS of the LISTENER
  ------------------------
  Alias                     LISTENER
  Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production
  Start Date                11-JUL-2011 19:15:54
  Uptime                  0 days 0 hr. 0 min. 0 sec
  Trace Level               off
  Security                  ON: Local OS Authentication
  SNMP                      OFF
  Listener Parameter File   /oracle/10g/network/admin/listener.ora
  Listener Log File         /oracle/10g/network/log/listener.log
  Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=aa.ly.com)(PORT=1521)))
  Services Summary...
  Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
  The command completed successfully
  $ lsnrctl stat
  LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 11-JUL-2011 19:16:23
  Copyright (c) 1991, 2007, Oracle.All rights reserved.
  Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=aa.ly.com)(PORT=1521)))
  STATUS of the LISTENER
  ------------------------
  Alias                     LISTENER
  Version                   TNSLSNR for Linux: Version 10.2.0.4.0 - Production
  Start Date                11-JUL-2011 19:15:54
  Uptime                  0 days 0 hr. 0 min. 29 sec
  Trace Level               off
  Security                  ON: Local OS Authentication
  SNMP                      OFF
  Listener Parameter File   /oracle/10g/network/admin/listener.ora
  Listener Log File         /oracle/10g/network/log/listener.log
  Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=aa.ly.com)(PORT=1521)))
  Services Summary...
  Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
  Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
  Service "pdb" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
  Service "pdb_XPT" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
  The command completed successfully
  $ more /etc/hosts
  # Do not remove the following line, or various programs
  # that require network functionality will fail.
  127.0.0.1               localhost.localdomain localhost
  ::1             localhost6.localdomain6 localhost6
  10.1.1.130            aa.ly.com
  10.1.1.181            bb.ly.com
  10.1.1.179            cc.ly.com
  $ cd /archive/
  $ mkdir rman
  $ ll -d rman/
  drwxr-xr-x 2 oracle oinstall 4096 Jul 11 19:19 rman/
  $ rman target /

  Recovery Manager:>  Copyright (c) 1982, 2007, Oracle.All rights reserved.
  connected to target database: ORCL (DBID=1284021567)
  RMAN> backup format '/archive/rman/bk_%u' current controlfile for standby;
  Starting backup at 11-JUL-11
  using target database control file instead of recovery catalog
  allocated channel: ORA_DISK_1
  channel ORA_DISK_1: sid=136 devtype=DISK
  channel ORA_DISK_1: starting full datafile backupset
  channel ORA_DISK_1: specifying datafile(s) in backupset
  including standby control file in backupset
  channel ORA_DISK_1: starting piece 1 at 11-JUL-11
  channel ORA_DISK_1: finished piece 1 at 11-JUL-11
  piece handle=/archive/rman/bk_01mh6lud tag=TAG20110711T191941 comment=NONE
  channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
  Finished backup at 11-JUL-11
  RMAN> backup format '/archive/rman/backup_%u' database plus archivelog;
  Starting backup at 11-JUL-11
  current log archived
  using channel ORA_DISK_1
  channel ORA_DISK_1: starting archive log backupset
  channel ORA_DISK_1: specifying archive log(s) in backup set
  input archive log thread=1 sequence=1 recid=1 stamp=756241830
  input archive log thread=1 sequence=2 recid=2 stamp=756242418
  channel ORA_DISK_1: starting piece 1 at 11-JUL-11
  channel ORA_DISK_1: finished piece 1 at 11-JUL-11
  piece handle=/archive/rman/backup_02mh6lvi tag=TAG20110711T192018 comment=NONE
  channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
  Finished backup at 11-JUL-11
  Starting backup at 11-JUL-11
  using channel ORA_DISK_1
  channel ORA_DISK_1: starting full datafile backupset
  channel ORA_DISK_1: specifying datafile(s) in backupset
  input datafile fno=00001 name=/oracle/oradata/orcl/system01.dbf
  input datafile fno=00003 name=/oracle/oradata/orcl/sysaux01.dbf
  input datafile fno=00002 name=/oracle/oradata/orcl/undotbs01.dbf
  input datafile fno=00004 name=/oracle/oradata/orcl/users01.dbf
  channel ORA_DISK_1: starting piece 1 at 11-JUL-11
  channel ORA_DISK_1: finished piece 1 at 11-JUL-11
  piece handle=/archive/rman/backup_03mh6lvk tag=TAG20110711T192020 comment=NONE
  channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
  channel ORA_DISK_1: starting full datafile backupset
  channel ORA_DISK_1: specifying datafile(s) in backupset
  including current control file in backupset
  channel ORA_DISK_1: starting piece 1 at 11-JUL-11
  channel ORA_DISK_1: finished piece 1 at 11-JUL-11
  piece handle=/archive/rman/backup_04mh6m11 tag=TAG20110711T192020 comment=NONE
  channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
  Finished backup at 11-JUL-11
  Starting backup at 11-JUL-11
  current log archived
  using channel ORA_DISK_1
  channel ORA_DISK_1: starting archive log backupset
  channel ORA_DISK_1: specifying archive log(s) in backup set
  input archive log thread=1 sequence=3 recid=3 stamp=756242467
  channel ORA_DISK_1: starting piece 1 at 11-JUL-11
  channel ORA_DISK_1: finished piece 1 at 11-JUL-11
  piece handle=/archive/rman/backup_05mh6m14 tag=TAG20110711T192108 comment=NONE
  channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
  Finished backup at 11-JUL-11
  ==============================================================================
  备库
  $ mkdir /oracle/oradata/orcl/
  $ mkdir /oracle/admin/orcl/{a,b,c,d,u}dump -p
  $ mkdir -p /archive/rman/
  ============================================================================================================================
  主库
  $ scp /oracle/10g/dbs/orapworcl 10.1.1.179:/oracle/10g/dbs/
  oracle@10.1.1.179's password:
  orapworcl                                     100% 1536   1.5KB/s   00:00
  $ scp /oracle/10g/dbs/initorcl.ora 10.1.1.179:/oracle/10g/dbs
  oracle@10.1.1.179's password:
  initorcl.ora                                  100% 1265   1.2KB/s   00:00
  $ scp/archive/rman/* 10.1.1.179:/archive/rman/
  oracle@10.1.1.179's password:
  backup_02mh6lvi                               100%   49MB   1.5MB/s   00:32
  backup_03mh6lvk                               100%519MB   1.2MB/s   07:13
  backup_04mh6m11                               100% 6944KB   1.1MB/s   00:06
  backup_05mh6m14                               100%440KB 440.0KB/s   00:00
  bk_01mh6lud                                 100% 6944KB 992.0KB/s   00:07
  ==============================================================================
  备库
  # vim /etc/hosts
  # more !$
  more /etc/hosts
  # Do not remove the following line, or various programs
  # that require network functionality will fail.
  127.0.0.1               localhost.localdomain localhost
  ::1             localhost6.localdomain6 localhost6
  10.1.1.179      cc.ly.com
  10.1.1.130      aa.ly.com
  # /etc/init.d/iptables status
  Firewall is stopped.
  # cd /oracle/10g/dbs/
  # ls
  initdw.orainit.orainitorcl.oraorapworcl
  # vim initorcl.ora
  # tail -8 !$
  tail -8 initorcl.ora
  db_unique_name=sdb
  log_archive_config='dg_config=(pdb,sdb)'
  fal_server=pdb
  fal_client=sdb
  log_archive_dest_2='service=pdb lgwr sync affirm valid_for=(online_logfile,primary_role) db_unique_name=pdb'
  log_archive_dest_state_1=ENABLE
  log_archive_dest_state_2=ENABLE
  standby_file_management=AUTO
  $ scp 10.1.1.130:/oracle/10g/network/admin/listener.ora /oracle/10g/network/admin/
  The authenticity of host '10.1.1.130 (10.1.1.130)' can't be established.
  RSA key fingerprint is 90:77:6a:f8:dd:ea:2b:85:ba:f3:a8:6c:c9:03:8c:ac.
  Are you sure you want to continue connecting (yes/no)? yes
  Warning: Permanently added '10.1.1.130' (RSA) to the list of known hosts.
  oracle@10.1.1.130's password:
  listener.ora                                  100%371   0.4KB/s   00:00
  $ scp 10.1.1.130:/oracle/10g/network/admin/tnsnames.ora /oracle/10g/network/admin/
  oracle@10.1.1.130's password:
  tnsnames.ora                                  100%474   0.5KB/s   00:00
  $ vim /oracle/10g/network/admin/listener.ora
  $ vim /oracle/10g/network/admin/tnsnames.ora
  $ sqlplus sys/oracle@pdb as sysdba

  SQL*Plus:>  Copyright (c) 1982, 2007, Oracle.All Rights Reserved.
  Connected to:

  Oracle Database 10g Enterprise Edition>  With the Partitioning, OLAP, Data Mining and Real Application Testing options
  SQL> exit

  Disconnected from Oracle Database 10g Enterprise Edition>  With the Partitioning, OLAP, Data Mining and Real Application Testing options
  $ more /oracle/10g/network/admin/listener.ora
  # listener.ora Network Configuration File: /oracle/10g/network/admin/listener.or
  a
  # Generated by Oracle configuration tools.
  SID_LIST_LISTENER =
  (SID_LIST =
  (SID_DESC =
  (GLOBAL_DBNAME = orcl)
  (ORACLE_HOME = /oracle/10g)
  (SID_NAME = orcl)
  )
  )
  LISTENER =
  (DESCRIPTION =
  (ADDRESS = (PROTOCOL = TCP)(HOST = cc.ly.com)(PORT = 1521))
  )
  $ more /oracle/10g/network/admin/tnsnames.ora
  # tnsnames.ora Network Configuration File: /oracle/10g/network/admin/tnsnames.or
  a
  # Generated by Oracle configuration tools.
  PDB =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.130)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SERVICE_NAME = pdb)
  )
  )
  SDB =
  (DESCRIPTION =
  (ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.1.179)(PORT = 1521))
  )
  (CONNECT_DATA =
  (SERVICE_NAME = sdb)
  )
  )
  $ sqlplus / as sysdba

  SQL*Plus:>  Copyright (c) 1982, 2007, Oracle.All Rights Reserved.

  Connected to an>  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 Error: 2: No such file or directory
  SQL> exit
  Disconnected
  $ mkdir /oracle/flash_recovery_area
  $ sqlplus / as sysdba

  SQL*Plus:>  Copyright (c) 1982, 2007, Oracle.All Rights Reserved.

  Connected to an>  SQL> startup nomount
  ORACLE instance started.
  Total System Global Area603979776 bytes

  Fixed>
  Variable>  Database Buffers          432013312 bytes
  Redo Buffers                7118848 bytes
  SQL> create spfile from pfile;
  File created.
  SQL>
  # ssh 10.1.1.179
  root@10.1.1.179's password:
  Last login: Mon Jul 11 19:28:14 2011 from aa.ly.com
  # su - oracle
  $ rman target sys/oracle@pdb auxiliary /

  Recovery Manager:>  Copyright (c) 1982, 2007, Oracle.All rights reserved.
  connected to target database: ORCL (DBID=1284021567)
  connected to auxiliary database: ORCL (not mounted)
  RMAN> duplicate target database for standby nofilenamecheck;
  Starting Duplicate Db at 11-JUL-11
  using target database control file instead of recovery catalog
  allocated channel: ORA_AUX_DISK_1
  channel ORA_AUX_DISK_1: sid=155 devtype=DISK
  contents of Memory Script:
  {
  restore clone standby controlfile;
  sql clone 'alter database mount standby database';
  }
  executing Memory Script
  Starting restore at 11-JUL-11
  using channel ORA_AUX_DISK_1
  channel ORA_AUX_DISK_1: starting datafile backupset restore
  channel ORA_AUX_DISK_1: restoring control file
  channel ORA_AUX_DISK_1: reading from backup piece /archive/rman/bk_01mh6lud
  channel ORA_AUX_DISK_1: restored backup piece 1
  piece handle=/archive/rman/bk_01mh6lud tag=TAG20110711T191941
  channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
  output filename=/oracle/oradata/orcl/control01.ctl
  output filename=/oracle/oradata/orcl/control02.ctl
  output filename=/oracle/oradata/orcl/control03.ctl
  Finished restore at 11-JUL-11

  sql statement:>  released channel: ORA_AUX_DISK_1
  contents of Memory Script:
  {
  set newname for tempfile1 to
  "/oracle/oradata/orcl/temp01.dbf";
  switch clone tempfile all;
  set newname for datafile1 to
  "/oracle/oradata/orcl/system01.dbf";
  set newname for datafile2 to
  "/oracle/oradata/orcl/undotbs01.dbf";
  set newname for datafile3 to
  "/oracle/oradata/orcl/sysaux01.dbf";
  set newname for datafile4 to
  "/oracle/oradata/orcl/users01.dbf";
  restore
  check readonly
  clone database
  ;
  }
  executing Memory Script
  executing command: SET NEWNAME
  renamed temporary file 1 to /oracle/oradata/orcl/temp01.dbf in control file
  executing command: SET NEWNAME
  executing command: SET NEWNAME
  executing command: SET NEWNAME
  executing command: SET NEWNAME
  Starting restore at 11-JUL-11
  allocated channel: ORA_AUX_DISK_1
  channel ORA_AUX_DISK_1: sid=155 devtype=DISK
  channel ORA_AUX_DISK_1: starting datafile backupset restore
  channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
  restoring datafile 00001 to /oracle/oradata/orcl/system01.dbf
  restoring datafile 00002 to /oracle/oradata/orcl/undotbs01.dbf
  restoring datafile 00003 to /oracle/oradata/orcl/sysaux01.dbf
  restoring datafile 00004 to /oracle/oradata/orcl/users01.dbf
  channel ORA_AUX_DISK_1: reading from backup piece /archive/rman/backup_03mh6lvk
  channel ORA_AUX_DISK_1: restored backup piece 1
  piece handle=/archive/rman/backup_03mh6lvk tag=TAG20110711T192020
  channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:04:03
  Finished restore at 11-JUL-11
  contents of Memory Script:
  {
  switch clone datafile all;
  }
  executing Memory Script
  datafile 1 switched to datafile copy
  input datafile copy recid=5 stamp=756246019 filename=/oracle/oradata/orcl/system01.dbf
  datafile 2 switched to datafile copy
  input datafile copy recid=6 stamp=756246019 filename=/oracle/oradata/orcl/undotbs01.dbf
  datafile 3 switched to datafile copy
  input datafile copy recid=7 stamp=756246019 filename=/oracle/oradata/orcl/sysaux01.dbf
  datafile 4 switched to datafile copy
  input datafile copy recid=8 stamp=756246019 filename=/oracle/oradata/orcl/users01.dbf
  Finished Duplicate Db at 11-JUL-11
  RMAN>
  SQL> select open_mode from v$database;
  OPEN_MODE
  ----------
  MOUNTED

  SQL>>
  Database>  SQL> select open_mode from v$database;                   备库一般是处于mount状态
  OPEN_MODE
  ----------
  MOUNTED
  SQL> ho ps -ef | grep ora
  root      191318900 09:45 ?      00:00:33 hald-addon-storage: polling /dev/hdc
  root      258825660 09:47 pts/1    00:00:00 su - oracle
  oracle    258925880 09:47 pts/1    00:00:00 -bash
  root      279827690 09:59 pts/4    00:00:00 su - oracle
  oracle    279927980 09:59 pts/4    00:00:00 -bash
  oracle    3517   10 11:00 ?      00:00:04 ora_pmon_orcl
  oracle    3519   10 11:00 ?      00:00:00 ora_psp0_orcl
  oracle    3521   10 11:00 ?      00:00:00 ora_mman_orcl
  oracle    3523   10 11:00 ?      00:00:02 ora_dbw0_orcl
  oracle    3525   10 11:00 ?      00:00:00 ora_lgwr_orcl
  oracle    3527   10 11:00 ?      00:00:12 ora_ckpt_orcl
  oracle    3529   10 11:00 ?      00:00:00 ora_smon_orcl
  oracle    3531   10 11:00 ?      00:00:00 ora_reco_orcl
  oracle    3535   10 11:00 ?      00:00:02 ora_mmon_orcl
  oracle    3537   10 11:00 ?      00:00:00 ora_mmnl_orcl
  oracle    3545   10 11:00 ?      00:00:00 ora_arc0_orcl
  oracle    3547   10 11:00 ?      00:00:00 ora_arc1_orcl
  oracle    3555   10 11:01 ?      00:00:02 ora_p000_orcl
  oracle    3557   10 11:01 ?      00:00:01 ora_p001_orcl
  oracle    3564   10 11:03 ?      00:00:01 /oracle/10g/bin/tnslsnr LISTENER -inherit
  oracle    3590   10 11:15 ?      00:00:05 oracleorcl (LOCAL=NO)
  oracle    3624   10 11:31 ?      00:00:02 oracleorcl (LOCAL=NO)
  oracle    3626   10 11:31 ?      00:00:00 oracleorcl (LOCAL=NO)
  oracle    3770   10 12:36 ?      00:00:02 ora_mrp0_orcl   ********************************************
  oracle    3772   10 12:36 ?      00:00:00 ora_s001_orcl
  oracle    3776   10 12:37 ?      00:00:00 ora_d000_orcl
  root      397826630 14:19 pts/2    00:00:00 su - oracle
  oracle    397939780 14:19 pts/2    00:00:00 -bash
  oracle    400939790 14:20 pts/2    00:00:00 rlwrap sqlplus / as sysdba
  oracle    401040090 14:20 pts/3    00:00:00 sqlplus   as sysdba
  oracle    401140100 14:20 ?      00:00:00 oracleorcl (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
  oracle    406627990 14:37 pts/4    00:00:00 tail -f alert_orcl.log
  oracle    407940100 14:44 pts/3    00:00:00 /bin/bash -c ps -ef | grep ora
  oracle    408040790 14:44 pts/3    00:00:00 ps -ef
  oracle    408140790 14:44 pts/3    00:00:00 grep ora
  ===========================================================
  验证数据同步
  主库
  SQL> select name from v$tablespace;
  NAME
  ------------------------------
  SYSTEM
  UNDOTBS1
  SYSAUX
  USERS
  TEMP
  SQL> select name from v$datafile;
  NAME
  --------------------------------------------------------------------------------
  /oracle/oradata/orcl/system01.dbf
  /oracle/oradata/orcl/undotbs01.dbf
  /oracle/oradata/orcl/sysaux01.dbf
  /oracle/oradata/orcl/users01.dbf

  SQL> create tablespace t1 datafile '/oracle/oradata/orcl/t1.dbf'>  Tablespace created.
  SQL> select name from v$tablespace;
  NAME
  ------------------------------
  SYSTEM
  UNDOTBS1
  SYSAUX
  USERS
  TEMP
  T1
  6 rows selected.
  SQL> select name from v$datafile;
  NAME
  --------------------------------------------------------------------------------
  /oracle/oradata/orcl/system01.dbf
  /oracle/oradata/orcl/undotbs01.dbf
  /oracle/oradata/orcl/sysaux01.dbf
  /oracle/oradata/orcl/users01.dbf
  /oracle/oradata/orcl/t1.dbf
  备库
  SQL> select name from v$tablespace;
  NAME
  ------------------------------
  SYSTEM
  UNDOTBS1
  SYSAUX
  USERS
  TEMP
  SQL> select name from v$datafile;
  NAME
  --------------------------------------------------------------------------------
  /oracle/oradata/orcl/system01.dbf
  /oracle/oradata/orcl/undotbs01.dbf
  /oracle/oradata/orcl/sysaux01.dbf
  /oracle/oradata/orcl/users01.dbf
  主库

  SQL>>
  System>  备库
  SQL> select name from v$datafile;
  NAME
  --------------------------------------------------------------------------------
  /oracle/oradata/orcl/system01.dbf
  /oracle/oradata/orcl/undotbs01.dbf
  /oracle/oradata/orcl/sysaux01.dbf
  /oracle/oradata/orcl/users01.dbf
  /oracle/oradata/orcl/t1.dbf
  SQL> select name from v$tablespace;
  NAME
  ------------------------------
  SYSTEM
  UNDOTBS1
  SYSAUX
  USERS
  TEMP
  T1
  6 rows selected.
  主库
  SQL> drop tablespace t1 including contents and datafiles;             删除表空间的同时删除dbf 文件
  Tablespace dropped.

  SQL>>
  System>  备库
  SQL> select name from v$tablespace;
  NAME
  ------------------------------
  SYSTEM
  UNDOTBS1
  SYSAUX
  USERS
  TEMP
  SQL> select name from v$datafile;
  NAME
  --------------------------------------------------------------------------------
  /oracle/oradata/orcl/system01.dbf
  /oracle/oradata/orcl/undotbs01.dbf
  /oracle/oradata/orcl/sysaux01.dbf
  /oracle/oradata/orcl/users01.dbf
  **************************************************************************************************************************
  要看信息tail -f /oracle/admin/orcl/bdump/alert_orcl.log
  同步数据的考虑
  1 日志没有从主到备   网络问题(监听,防火墙,IP)   参数文件里的log_archive_dest_2   备库的目录和容量
  2 日志过去了但是没有应用   mrp进程要开启      是否出现了归档日志断点(找到缺少的归档日志,重新在rman里注册)

页: [1]
查看完整版本: oracle dataguard-linuxart