|
|
|
主库
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
SQL> conn testuser/system
Connected.
SQL> select count(*) from tab;
COUNT(*)
----------
2
SQL> select tname from tab;
TNAME
------------------------------
T_NEWDG
T_TESTUSER
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
导出主库testuser用户t_newdg表
[oracle@langfang ~]$ exp userid=testuser/system file=exp_t_newdg.dmp tables=t_newdg
Export: Release 11.2.0.4.0 - Production on Fri Apr 10 22:22:29 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. 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
Export done in ZHS16GBK character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table T_NEWDG 1 rows exported
Export terminated successfully without warnings.
删除主库上述导出的表
[oracle@langfang ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.4.0 Production on Fri Apr 10 22:24:27 2015
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> drop table testuser.t_newdg purge;
Table dropped.
SQL> alter system switch logfile;
System altered.
确认主库已删表已同步至备库
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> select count(*) from testuser.t_newdg;
select count(*) from testuser.t_newdg
*
ERROR at line 1:
ORA-00942: table or view does not exist
在主库导入上述已导出的DMP文件
[oracle@langfang ~]$ imp userid=testuser/system file=exp_t_newdg.dmp tables=t_newdg
Import: Release 11.2.0.4.0 - Production on Fri Apr 10 22:28:23 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. 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
Export file created by EXPORT:V11.02.00 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. importing TESTUSER's objects into TESTUSER
. importing TESTUSER's objects into TESTUSER
. . importing table "T_NEWDG" 1 rows imported
Import terminated successfully without warnings.
[oracle@langfang ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 11.2.0.4.0 Production on Fri Apr 10 22:28:40 2015
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 count(*) from testuser.t_newdg;
COUNT(*)
----------
1
SQL> alter system switch logfile;
System altered.
确认主库变更同步至备库
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> select count(*) from testuser.t_newdg;
COUNT(*)
----------
1
|
| 如果在主库导入exp导出的DMP文件,会自动同步至备库 |
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9240380/viewspace-1562924/ ,如需转载,请注明出处,否则将追究法律责任。