oracle dataguard

主庫  10.1.1.130    備庫  10.1.1.179

======================================

主庫

[oracle@aa ~]$ echo $ORACLE_SID
orcl
[oracle@aa ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jul 11 19:02:34 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
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 Area  603979776 bytes
Fixed Size                  1268872 bytes
Variable Size             163578744 bytes
Database Buffers          432013312 bytes
Redo Buffers                7118848 bytes
Database mounted.
SQL> alter database archivelog;         必須

Database altered.

SQL> alter database force logging;       必須

Database altered.

SQL> alter system set log_archive_dest_1='location=/archive/';        修改路徑,不然就放到閃回區了

System altered.

SQL> alter database open;

Database altered.

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 Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@aa ~]$ vim $ORACLE_HOME/dbs/initorcl.ora
[oracle@aa ~]$ 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
[oracle@aa ~]$ /etc/init.d/iptables status
Firewall is stopped.
[oracle@aa ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jul 11 19:09:23 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup nomount pfile='$ORACLE_HOME/dbs/initorcl.ora'
ORACLE instance started.

Total System Global Area  603979776 bytes
Fixed Size                  1268872 bytes
Variable Size             163578744 bytes
Database Buffers          432013312 bytes
Redo Buffers                7118848 bytes
SQL> create spfile from pfile;

File created.

SQL> alter database mount;

Database altered.

SQL> alter database open;

Database altered.

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
orcl

SQL> select name from v$database;

NAME
---------
ORCL


配置監聽

圖  主庫監聽

[oracle@aa ~]$ cd /oracle/10g/network/admin/
[oracle@aa 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))
  )

[oracle@aa admin]$ 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)
    )
  )

開啓監聽

[oracle@aa admin]$ 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
[oracle@aa admin]$ 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


[oracle@aa admin]$ 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

[oracle@aa ~]$ cd /archive/
[oracle@aa archive]$ mkdir rman
[oracle@aa archive]$ ll -d rman/
drwxr-xr-x 2 oracle oinstall 4096 Jul 11 19:19 rman/


[oracle@aa admin]$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Mon Jul 11 19:18:14 2011

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

==============================================================================
備庫


[oracle@cc ~]$ mkdir /oracle/oradata/orcl/

[oracle@cc orcl]$ mkdir /oracle/admin/orcl/{a,b,c,d,u}dump -p

[oracle@aa archive]$ mkdir -p /archive/rman/

============================================================================================================================
主庫

[oracle@aa ~]$ scp /oracle/10g/dbs/orapworcl 10.1.1.179:/oracle/10g/dbs/
[email protected]'s password:
orapworcl                                     100% 1536     1.5KB/s   00:00   
[oracle@aa ~]$ scp /oracle/10g/dbs/initorcl.ora 10.1.1.179:/oracle/10g/dbs
[email protected]'s password:
initorcl.ora                                  100% 1265     1.2KB/s   00:00   
[oracle@aa ~]$ scp  /archive/rman/* 10.1.1.179:/archive/rman/
[email protected]'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   

==============================================================================

備庫

[root@cc ~]# vim /etc/hosts
[root@cc ~]# 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
[root@cc ~]# /etc/init.d/iptables status
Firewall is stopped.

[root@cc ~]# cd /oracle/10g/dbs/
[root@cc dbs]# ls
initdw.ora  init.ora  initorcl.ora  orapworcl
[root@cc dbs]# vim initorcl.ora
[root@cc dbs]# 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


[oracle@cc ~]$ 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.
[email protected]'s password:
listener.ora                                  100%  371     0.4KB/s   00:00   
[oracle@cc ~]$ scp 10.1.1.130:/oracle/10g/network/admin/tnsnames.ora /oracle/10g/network/admin/
[email protected]'s password:
tnsnames.ora                                  100%  474     0.5KB/s   00:00   
[oracle@cc ~]$ vim /oracle/10g/network/admin/listener.ora
[oracle@cc ~]$ vim /oracle/10g/network/admin/tnsnames.ora
[oracle@cc ~]$ sqlplus sys/oracle@pdb as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jul 11 20:03:46 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@cc ~]$ 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))
  )

[oracle@cc ~]$ 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)
    )
  )


[oracle@cc ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jul 11 20:10:36 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

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
[oracle@cc ~]$ mkdir /oracle/flash_recovery_area
[oracle@cc ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jul 11 20:12:59 2011

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area  603979776 bytes
Fixed Size                  1268872 bytes
Variable Size             163578744 bytes
Database Buffers          432013312 bytes
Redo Buffers                7118848 bytes
SQL> create spfile from pfile;

File created.

SQL>

[root@aa ~]# ssh 10.1.1.179
[email protected]'s password:
Last login: Mon Jul 11 19:28:14 2011 from aa.ly.com
[root@cc ~]# su - oracle
[oracle@cc ~]$ rman target sys/oracle@pdb auxiliary /

Recovery Manager: Release 10.2.0.4.0 - Production on Mon Jul 11 20:15:22 2011

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: alter database mount standby database
released channel: ORA_AUX_DISK_1

contents of Memory Script:
{
   set newname for tempfile  1 to
 "/oracle/oradata/orcl/temp01.dbf";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/oracle/oradata/orcl/system01.dbf";
   set newname for datafile  2 to
 "/oracle/oradata/orcl/undotbs01.dbf";
   set newname for datafile  3 to
 "/oracle/oradata/orcl/sysaux01.dbf";
   set newname for datafile  4 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> alter database recover managed standby database disconnect from session;    開啓mrp 進程

Database altered.


SQL> select open_mode from v$database;                   備庫一般是處於mount狀態

OPEN_MODE
----------
MOUNTED


SQL> ho ps -ef | grep ora
root      1913  1890  0 09:45 ?        00:00:33 hald-addon-storage: polling /dev/hdc
root      2588  2566  0 09:47 pts/1    00:00:00 su - oracle
oracle    2589  2588  0 09:47 pts/1    00:00:00 -bash
root      2798  2769  0 09:59 pts/4    00:00:00 su - oracle
oracle    2799  2798  0 09:59 pts/4    00:00:00 -bash
oracle    3517     1  0 11:00 ?        00:00:04 ora_pmon_orcl
oracle    3519     1  0 11:00 ?        00:00:00 ora_psp0_orcl
oracle    3521     1  0 11:00 ?        00:00:00 ora_mman_orcl
oracle    3523     1  0 11:00 ?        00:00:02 ora_dbw0_orcl
oracle    3525     1  0 11:00 ?        00:00:00 ora_lgwr_orcl
oracle    3527     1  0 11:00 ?        00:00:12 ora_ckpt_orcl
oracle    3529     1  0 11:00 ?        00:00:00 ora_smon_orcl
oracle    3531     1  0 11:00 ?        00:00:00 ora_reco_orcl
oracle    3535     1  0 11:00 ?        00:00:02 ora_mmon_orcl
oracle    3537     1  0 11:00 ?        00:00:00 ora_mmnl_orcl
oracle    3545     1  0 11:00 ?        00:00:00 ora_arc0_orcl
oracle    3547     1  0 11:00 ?        00:00:00 ora_arc1_orcl
oracle    3555     1  0 11:01 ?        00:00:02 ora_p000_orcl
oracle    3557     1  0 11:01 ?        00:00:01 ora_p001_orcl
oracle    3564     1  0 11:03 ?        00:00:01 /oracle/10g/bin/tnslsnr LISTENER -inherit
oracle    3590     1  0 11:15 ?        00:00:05 oracleorcl (LOCAL=NO)
oracle    3624     1  0 11:31 ?        00:00:02 oracleorcl (LOCAL=NO)
oracle    3626     1  0 11:31 ?        00:00:00 oracleorcl (LOCAL=NO)
oracle    3770     1  0 12:36 ?        00:00:02 ora_mrp0_orcl     ********************************************
oracle    3772     1  0 12:36 ?        00:00:00 ora_s001_orcl
oracle    3776     1  0 12:37 ?        00:00:00 ora_d000_orcl
root      3978  2663  0 14:19 pts/2    00:00:00 su - oracle
oracle    3979  3978  0 14:19 pts/2    00:00:00 -bash
oracle    4009  3979  0 14:20 pts/2    00:00:00 rlwrap sqlplus / as sysdba
oracle    4010  4009  0 14:20 pts/3    00:00:00 sqlplus   as sysdba
oracle    4011  4010  0 14:20 ?        00:00:00 oracleorcl (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle    4066  2799  0 14:37 pts/4    00:00:00 tail -f alert_orcl.log
oracle    4079  4010  0 14:44 pts/3    00:00:00 /bin/bash -c ps -ef | grep ora
oracle    4080  4079  0 14:44 pts/3    00:00:00 ps -ef
oracle    4081  4079  0 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' size 1m;

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> alter system switch logfile;

System altered.

備庫

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> alter system switch logfile;

System altered.

備庫

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裏註冊)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章