前提:从别的计算机得到一份数据库(矿总院药品价表等等数据库).
目的:把数据库里面的数据附加到本地数据库,从而可以查看数据库中的数据,取之应用.
必须了解信息:
原数据库全局数据库名称:oracle,SID:ORCL.
原数据库存放路径:E:/oracle/oracdata/
本地数据库的安装路径是D:/oracle/
实现步骤:
一、把数据库相关文件copy到本地E:/oracle/oracdata/下面,(确保文件不能缺少).
二、修改初始化文件init.ora,路径在D:/oracle/admin/oracle/pfile/init.ora
查找control_files = ("D:/oracle/oradata/oracle/control01.ctl", "D:/oracle/oradata/oracle/control02.ctl", "D:/oracle/oradata/oracle/control03.ctl")
修改为:
control_files = ("E:/oracle/oradata/oracle/control01.ctl", "E:/oracle/oradata/oracle/control02.ctl", "E:/oracle/oradata/oracle/control03.ctl")
三、重新启动实例.观察E:/oracle/oradata/oracle/下面的控制文件时间是否改变,如如果改变,说明控制文件已经附加成功.
四、修改字符集.
打开注册表查找: [HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE/HOME0]修改
"NLS_LANG"="AMERICAN_AMERICA.US7ASCII",原来"NLS_LANG"="SIMPLIFIED CHINESE_CHINA.ZHS16GBK",
目的是为了避免中文在数据库里面出现乱码的现象.
五、启动svrmgrl.
Svrmgrl>shutdown immediate;
重新启动实例.
六、改变数据库文件.
SVRMGR
>
alter database rename file
'
D:/oracle/oradata/oracle/INDX01.DBF
'
to
'
E:/oracle/oradata/oracle/INDX01.DBF’;
SVRMGR
>
alter database rename file
'
D:/oracle/oradata/oracle/DR01.DBF
'
to
'
E:/oracle/oradata/oracle/ DR01.DBF’;
SVRMGR
>
alter database rename file
'
D:/oracle/oradata/oracle/RBS01.DBF
'
to
'
E:/oracle/oradata/oracle/ RBS01.DBF’;
SVRMGR
>
alter database rename file
'
D:/oracle/oradata/oracle/SYSTEM01.DBF
'
to
'
E:/oracle/oradata/oracle/ SYSTEM01.DBF’;
SVRMGR
>
alter database rename file
'
D:/oracle/oradata/oracle/TEMP01.DBF
'
to
'
E:/oracle/oradata/oracle/ TEMP01.DBF’;
SVRMGR
>
alter database rename file
'
D:/oracle/oradata/oracle/USERS01.DBF
'
to
'
E:/oracle/oradata/oracle/ USERS01.DBF’;
SVRMGR
>
alter database rename file
'
D:/oracle/oradata/oracle/TOOLS01.DBF
'
to
'
E:/oracle/oradata/oracle/ TOOLS01.DBF’;
SVRMGR
>
alter database rename file
'
D:/oracle/oradata/oracle/REDO01.LOGF
'
to
'
E:/oracle/oradata/oracle/ REDO01.LOG’;
SVRMGR
>
alter database rename file
'
D:/oracle/oradata/oracle/REDO02.LOGF
'
to
'
E:/oracle/oradata/oracle/ REDO02.LOG’;
SVRMGR
>
alter database rename file
'
D:/oracle/oradata/oracle/REDO02.LOGF
'
to
'
E:/oracle/oradata/oracle/ REDO02.LOG’;
七、重新启动数据库实例.
八、修改密码文件.pwdorcl.ora(文件名根据SID名称改变),路径D:/oracle/ora81/database.
一般先备份一下密码文件.然后把改文件删除.
然后用orapwd命令重新生成密码文件.
C:/>orapwd file= D:/oracle/ora81/database/pwdorcl.ora password=oracle entries=5;
说明:file是生成的密码文件的完整的路径名称.password是新密码.
九、重新启动数据库.检查是否可以正常运行,如果运行失败,检查步骤是否全部符合.