朋友问题
问题分析
主库
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文件,会自动同步至备库 |
个人简介
8年oracle从业经验,具备丰富的oracle技能,目前在国内北京某专业oracle服务公司从事高级技术顾问。
服务过的客户:
中国电信
中国移动
中国联通
中国电通
国家电网
四川达州商业银行
湖南老百姓大药房
山西省公安厅
中国邮政
北京302医院
河北廊坊新奥集团公司
项目经验:
中国电信3G项目AAA系统数据库部署及优化
中国联通CRM数据库性能优化
中国移动10086电商平台数据库部署及优化
湖南老百姓大药房ERR数据库sql优化项目
四川达州商业银行TCBS核心业务系统数据库模型设计和RAC部署及优化
四川达州商业银行TCBS核心业务系统后端批处理存储过程功能模块编写及优化
北京高铁信号监控系统RAC数据库部署及优化
河南宇通客车数据库性能优化
中国电信电商平台核心采购模块表模型设计及优化
中国邮政储蓄系统数据库性能优化及sql优化
北京302医院数据库迁移实施
河北廊坊新奥data guard部署及优化
山西公安厅身份证审计数据库系统故障评估
国家电网上海灾备项目4 node rac+adg
贵州移动crm及客服数据库性能优化项目
贵州移动crm及客服数据库性能优化项目
联系方式:
手机:18201115468
qq : 305076427
qq微博: wisdomone1
新浪微博:wisdomone9
qq群:275813900
itpub博客名称:wisdomone1 http://blog.itpub.net/9240380/
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-1562924/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-1562924/