windows 迁移数据库
1) Prerequisites
----------------
- The copy of the datafiles must be done with the database closed or the database must be in ARCHIVELOG mode.
To determine the Database is in Archivemode or Noarchivemode use:
2) Init<sid>.ora or Spfile<sid>.ora and Controlfile
----------------------------------------------------
- You need to copy the init.ora or spfile file to the target host
and locate it in ORACLE_HOME\dbs
- Copy the
Controlfile(s),
all the Datafiles
all the Archivelogs generated,
to the target host.
# To copy the Controlfile,
- either do a clean shutdown the Database, then take a cold copy of the controlfile
- or if database is open and Online Backup is taken do:
-- Hint:
Do this to get a creation script for the controlfile, in case needed.
The following statement writes a tracefile to the 'trace' directory containing 'Create Controlfile' Statements
.
SQL> alter database backup controlfile to trace ;
# To backup the Database if database is open then, you need to put all the tablespaces in BACKUP MODE,
before starting the copy of the database/datafiles :
SQL> select tablespace_name from dba_tablespaces;
SQL> ALTER TABLESPACE <TABLESPACE_NAME> BEGIN BACKUP;
.
> copy all the tablespace 'datafiles'
.
SQL> ALTER TABLESPACE <TABLESPACE_NAME> END BACKUP;
# ==> Do this copy for 'ALL THE TABLESPACES/Datafiles' in the Database !!
# Comment: Starting with Oracle 10g:
you can use the BEGIN BACKUP on 'database' level, instead of 'tablespace' level :
SQL> alter DATABASE begin backup;
.
> copy all the tablespace 'datafiles'
.
SQL> alter DATABASE end backup;
3) Set the oracle environment
-------------------------
C:\> sqlplus "sys/password as sysdba"
- Check the init<sid>.ora parameters that reference 'path/dir' location
control_files = <duplicate db control file(s)>
background_dump_dest = bdump>
core_dump_dest = cdump>
user_dump_dest = udump>
log_archive_dest_1 = <duplicate db arch dump location>
4) Set up a password file for the duplicated database
If Windows Platform, create a new NT service for the 'cloned' duplicated database using oradim.
# or
C:\> oradim -new -sid -intpwd -maxusers 10 -startmode manual -pfile ''
sample:
1) orapwd file=C:\app\oracle\product\12.1.0\dbhome_1\database\orapwtestUAT12C.ora password=oracle123
2)oradim -new -sid testUAT12C -SYSPWD oracle123 -maxusers 10 -startmode manual -pfile 'C:\app\oracle\product\12.1.0\dbhome_1\database\INITtestUAT12C.ORA'
3) copy network from source to destination
6) Startup the database in mount status
-- Rename any of the datafiles to the new location, if necessary:
SQL> ALTER DATABASE RENAME FILE
'/FULL_PATH_OF_OLD_LOCATION/AND_DATAFILE_NAME.DBF'
TO
'/FULL_PATH_OF_NEW_LOCATION/AND_DATAFILE_NAME.DBF';
-- Rename the logfiles to the new location if necessary
SQL> alter database rename file '<host A location>' to '<host B location>';
7) Check that all the datafiles are in the right location and ONLINE:
8) Perform incomplete recovery:
Forward the database applying archived redo log files until you decide
to stop recovery by typing 'CANCEL' at the prompt
(assuming that you have required archived redo log files in the log_archive_dest directory)
.
You may archive the source database redo log files and apply them at
the target database if required.
9) In Windows platforms, if you want that the database will start automatically then edit the registry:
go to
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOMEX
.
change the key : ORA_<SID>_AUTOSTART=TRUE
1.make file and modfiy file:
'C:\app\Administrator\product\11.2.0\dbhome_1\database\initdmprod.ora'
2.
orapwd file=C:\app\Administrator\product\11.2.0\dbhome_1\database\PWDDMSPROD.ora password=oracle123
oradim -new -sid dmsprod -SYSPWD oracle123 -maxusers 10 -startmode manual -pfile 'C:\app\Administrator\product\11.2.0\dbhome_1\database\initdmsprod.ora'
3.
C:\app\Administrator\admin
set ORACLE_SID=dmprod
sqlplus "sys/oralce as sysdba"
startup mount
##change data file location to 'D:\dmsprod'
rman nocatalog target /
catalog start with 'D:\dmsprod';
switch database to copy;
sqlplus "sys/oralce as sysdba"
select 'alter database rename file '||''''||member||''''||' to '||chr(39)||replace(member,'F:\ORA11GDATA\DMSPROD\','D:\dmsprod\')||''';' from v$logfile;
shutdown immediate
startup
ALTER TABLESPACE TEMP ADD TEMPFILE 'D:\DMSPROD\TEMP01.DBF' REUSE;
ALTER TABLESPACE TEMP drop TEMPFILE 'F:\ORA11GDATA\DMSPROD\TEMP01.DBF';
4.
add service_names='DMSUAT,DMSPROD’
select service_id,name from v$services;
相关文章
- 解决Windows 10下Wireshark运行问题
- (Windows Maven项目)Redis数据库的安装和操作实现
- [windows菜鸟]C#中调用Windows API的技术要点说明
- 美国国家安全局网络武器被公开,微软宣布已修复可攻破的 Windows 漏洞
- docker for windows--快速搭建各种关系型数据库RMDB的测试环境
- docker for windows--Windows 10 家庭中文版安装apache zeppelin 0.10.1版本及安全配置
- 【Windows】+ win10激活
- 【Windows】+ windows下在某一文件夹下按“shift+鼠标右键”打开CMD窗口
- Python编程-数据库-利用PyMysql访问windows下的MySql数据库
- Go & SQLite on Windows
- 《Windows 8 开发权威指南:HTML5 和JavaScript卷》——1.4 Visual Studio 2012新特性
- 转 OUI and OPatch Do Not Recognize JDK/JRE on Windows
- Windows server 2012 64位 连接Access数据库"未发现数据源名称并且未指定默认驱动程序"的解决办法
- Windows 10文件资源管理器出现微软OneDrive广告
- 云端运行Windows企业级选项探索
- Windows 8.1 新增控件之 CommandBar
- 【MongoDB】windows平台搭建Mongo数据库复制集(类似集群)(转)
- 使用Oradim恢复Windows上的数据库
- Windows搭建Eclipse+JDK+SDK的Android --安卓开发入门级
- Robot:robot如何连接Oracle数据库(windows+linux)
- windows下spark开发环境配置
- Windows下MySQL service manager数据库/mysqld.exe占用内存解决方法/Workbench 10061错误/Navicat 10038错误
- 谁来管理Windows容器?IT人员表示‘我说了算’
- C/C++教程 第九章 —— windows编程入门
- 【AI学习笔记】TensorFlow 与 Keras的安装(Windows Anaconda 虚拟环境版)
- 玩转Windows,超简单一个命令进行windows系统升级,在需要的时间点,随时进行系统升级,体验最新的系统和特性