(一)写这篇文章的起因
这篇文章适合刚接触的技术小白follow操作,整理文章不易,大家多多点赞+转发
起因是昨天有会员在群里发问,客户要把Oracle整个目录从C盘挪到D盘怎么弄
客户那边的人把Oracle整个程序+数据文件都安装到了C盘上,现在面临着C盘空间不足,还有不知名的原因导致Oracle会话总是中断(这个有点玄学),客户让整体迁移
直接拷贝肯定是不行,Windows上Oracle还有一堆注册表,不像Linux拷贝过去改过挂载点就行。
整体思路其实不难,稍微有一些注意事项:
1、停库,停服务。备份物理文件(控制文件、数据文件、日志文件、SPFILE、口令文件)。D盘重新安装个Oracle,然后把刚才备份的物理文件放过去,调整一下参数。
2、停库,停服务。文件剪切到别的盘,在原地创建个软链接mklink,指向新的盘符。
3、其实是只移动数据文件就行,不用那么麻烦(这里客户不让我就不讲了,就是改改文件位置就完了)
下面来看1、2两个方法如何操作。(我以windows2016+oracle19c为演示环境)
(二)迁移方法1:重新安装
1.迁移前准备环境
查看当前安装目录
C:\Users\Administrator>echo %PATH%
C:\app\oracle\product\19.3\dbhome_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;
关库迁移前,确认好数据文件位置,这里要用到两个脚本
1.生成修改文件位置语句
set pagesize 500
set linesize 500
select 'alter database rename file '||''''||name||''''||' to '||chr(39)||replace(name,'C:\APP\ADMINISTRATOR\ORADATA\ORCL\','D:\APP\ADMINISTRATOR\ORADATA\ORCL\')||''';' from v$tempfile where name like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%'
union
select 'alter database rename file '||''''||name||''''||' to '||chr(39)||replace(name,'C:\APP\ADMINISTRATOR\ORADATA\ORCL\','D:\APP\ADMINISTRATOR\ORADATA\ORCL\')||''';' from v$datafile where name like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%'
union
select 'alter database rename file '||''''||member||''''||' to '||chr(39)||replace(member,'C:\APP\ADMINISTRATOR\ORADATA\ORCL\','D:\APP\ADMINISTRATOR\ORADATA\ORCL\')||''';' from v$logfile where member like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%';
执行结果如下:
SQL> set pagesize 500
SQL> set linesize 500
SQL> select 'alter database rename file '||''''||name||''''||' to '||chr(39)||replace(name,'C:\APP\ADMINISTRATOR\ORADATA\ORCL\','D:\APP\ADMINISTRATOR\ORADATA\ORCL\')||''';' from v$tempfile where name like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%'2 union3 select 'alter database rename file '||''''||name||''''||' to '||chr(39)||replace(name,'C:\APP\ADMINISTRATOR\ORADATA\ORCL\','D:\APP\ADMINISTRATOR\ORADATA\ORCL\')||''';' from v$datafile where name like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%'4 union5 select 'alter database rename file '||''''||member||''''||' to '||chr(39)||replace(member,'C:\APP\ADMINISTRATOR\ORADATA\ORCL\','D:\APP\ADMINISTRATOR\ORADATA\ORCL\')||''';' from v$logfile where member like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%';'ALTERDATABASERENAMEFILE'||''''||NAME||''''||'TO'||CHR(39)||REPLACE(NAME,'C:\APP\ADMINISTRATOR\ORADATA\ORCL\','D:\APP\ADMINISTRATOR\ORADATA\ORCL\')||''';'
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF';已选择 8 行。
2.生成拷贝文件语句
set pagesize 500
set linesize 500
select 'host copy '||''||member||''||' D:\APP\ADMINISTRATOR\ORADATA\ORCL\' from v$logfile where member like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%'
union
select 'host copy '||''||name||''||' D:\APP\ADMINISTRATOR\ORADATA\ORCL\ ' from v$datafile where name like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%'
union
select 'host copy '||''||name||''||' D:\APP\ADMINISTRATOR\ORADATA\ORCL\ ' from v$controlfile where name like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%'
union
select 'host copy '||''||name||''||' D:\APP\ADMINISTRATOR\ORADATA\ORCL\ ' from v$tempfile where name like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%';
执行结果如下:
SQL> set pagesize 500
SQL> set linesize 500
SQL> select 'host copy '||''||member||''||' D:\APP\ADMINISTRATOR\ORADATA\ORCL\' from v$logfile where member like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%'2 union3 select 'host copy '||''||name||''||' D:\APP\ADMINISTRATOR\ORADATA\ORCL\ ' from v$datafile where name like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%'4 union5 select 'host copy '||''||name||''||' D:\APP\ADMINISTRATOR\ORADATA\ORCL\ ' from v$controlfile where name like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%'6 union7 select 'host copy '||''||name||''||' D:\APP\ADMINISTRATOR\ORADATA\ORCL\ ' from v$tempfile where name like 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\%';'HOSTCOPY'||''||MEMBER||''||'D:\APP\ADMINISTRATOR\ORADATA\ORCL\'
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
3.查看参数文件位置,创建参数文件备份
SQL> set pagesize 100
SQL> set linesize 200
SQL> show parameter pfile;NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
spfile string C:\APP\ORACLE\PRODUCT\19.3\DBHOME_1\DATABASE\SPFILEORCL.ORA
SQL> create pfile='c:\pfile.ora' from spfile;
File created.
4.关闭数据库
SQL> shutdown immediate;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
5.停止以下服务
2.在D盘安装Oracle
D盘释放Oracle19c安装文件到如下目录
D:\app\oracle\product\19.3\dbhome_1
运行安装
这里注意一下,我是习惯用“使用windows内置账户”,避免权限带来的麻烦。
3.开始进行迁移
删除原有oracle服务,使用oradim命令,帮助参考如下
C:\Users>oradim
ORADIM: <command> [options]。请参阅手册。
输入以下命令之一:
通过指定以下选项创建实例:-NEW -SID sid | -ASMSID sid | -MGMTDBSID sid | -IOSSID sid | -APXSID sid|-SRVC srvc | -ASMSRVC srvc | -MGMTDBSRVC srvc | -IOSSRVC srvc |-APXSRVC srvc [-SYSPWD pass] [-STARTMODE auto|manual][-SRVCSTART system|demand] [-PFILE file | -SPFILE] [-MAXUSERS maxusers][-SHUTMODE normal|immediate|abort] [-TIMEOUT secs] [-RUNAS osusr/ospass]
通过指定以下选项编辑实例:-EDIT -SID sid | -ASMSID sid | -MGMTDBSID sid | -IOSSID sid | -APXSID sid[-SYSPWD pass] [-STARTMODE auto|manual] [-SRVCSTART system|demand][-PFILE file | -SPFILE] [-SHUTMODE normal|immediate|abort][-SHUTTYPE srvc|inst] [-RUNAS osusr/ospass]
通过指定以下选项删除实例:-DELETE -SID sid | -ASMSID sid | -MGMTDBSID sid | -IOSSID sid |-APXSID sid| -SRVC srvc | -ASMSRVC srvc | -MGMTDBSRVC srvc |-IOSSRVC srvc | -APXSRVC srvc
通过指定以下选项启动服务和实例:-STARTUP -SID sid | -ASMSID sid | -MGMTDBSID sid | -IOSSID sid| -APXSID sid [-SYSPWD pass] [-STARTTYPE srvc|inst|srvc,inst][-PFILE filename | -SPFILE]
通过指定以下选项关闭服务和实例:-SHUTDOWN -SID sid | -ASMSID sid | -MGMTDBSID sid | -IOSSID sid |-APXSID sid [-SYSPWD pass] [-SHUTTYPE srvc|inst|srvc,inst][-SHUTMODE normal|immediate|abort]
通过指定以下选项操纵 ACL:-ACL -setperm|-addperm|-removeperm dbfiles|diag|registry-USER username -OBJTYPE file|dir|registry -OBJPATH object-path-RECURSE true|false [-HOST hostname]
通过指定以下选项操纵 FAMILY 设置:-FAMILY -set|-delete value [-SID sid | -ASMSID sid |-MGMTDBSID sid | -IOSSID sid | -APXSID sid ]通过指定以下参数查询帮助: -? | -h | -help
1.执行删除服务命令
C:\app\oracle\product\19.3\dbhome_1\bin>oradim -delete -sid ORCL
实例已删除。
2.删除监。听,执行netca命令删除当前listener监听
3.修改先前备份的参数文件内容,主要修改一下文件路径C改为D:
*.audit_file_dest='D:\app\Administrator\admin\orcl\adump'
*.audit_trail='db'
*.compatible='19.0.0'
*.control_files='D:\app\Administrator\oradata\ORCL\control01.ctl','D:\app\Administrator\oradata\ORCL\control02.ctl'
*.db_block_size=8192
*.db_name='orcl'
*.diagnostic_dest='D:\app\Administrator'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.local_listener='LISTENER_ORCL'
*.nls_language='SIMPLIFIED CHINESE'
*.nls_territory='CHINA'
*.open_cursors=300
*.pga_aggregate_target=819m
*.processes=320
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=2457m
*.undo_tablespace='UNDOTBS1'
4.手动创建一下审计日志文件位置D:\app\Administrator\admin\orcl\adump
5.拷贝原有的口令文件ORACLE_HOME/database下到新的ORACLE_HOME/database目录下,如果没有就手动创建一下
D:\app\oracle\product\19.3\dbhome_1\database>orapwd file=pwdorcl.ora password=Dba_2024 ENTRIES=5
6.在新的Oracle_home\bin目录下执行netca创建监听(图形一直下一步就行)
C:\>cd d:\app\oracle\product\19.3\dbhome_1
C:\>d:
d:\app\oracle\product\19.3\dbhome_1>cd bin
d:\app\oracle\product\19.3\dbhome_1\bin>netca
7.再创建oracle实例服务
d:\app\oracle\product\19.3\dbhome_1\bin>set ORACLE_SID=ORCL
d:\app\oracle\product\19.3\dbhome_1\bin>set ORACLE_HOME=D:\app\oracle\product\19.3\dbhome_1
d:\app\oracle\product\19.3\dbhome_1\bin>oradim.exe -new -sid ORCL -startmode auto -spfile -SRVCSTART SYSTEM
实例已创建。
8.创建参数文件
d:\app\oracle\product\19.3\dbhome_1\bin>sqlplus / as sysdbaSQL*Plus: Release 19.0.0.0.0 - Production on 星期五 5月 17 20:58:45 2024
Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle. All rights reserved.已连接到空闲例程。SQL> create spfile from pfile='c:\pfile.ora';File created.SQL>
9.关闭windows系统服务OracleServiceORCL
再启动OracleServiceORCL服务,这里稍微等一会
这里数据库会启动到nomount模式
d:\app\oracle\product\19.3\dbhome_1\bin>sqlplus / as sysdbaSQL*Plus: Release 19.0.0.0.0 - Production on 星期五 5月 17 21:12:42 2024
Version 19.3.0.0.0Copyright (c) 1982, 2019, Oracle. All rights reserved.连接到:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0SQL> select status from v$instance;STATUS
------------------------
STARTED
10.创建新的数据文件目录D:\app\Administrator\oradata\ORCL
拷贝数据文件目录C:\app\Administrator\oradata\orcl目录下的控制文件至D:\app\Administrator\oradata\ORCL
SQL> host copy C:\app\Administrator\oradata\ORCL\CONTROL01.CTL D:\app\Administrator\oradata\ORCL
已复制 1 个文件。SQL> host copy C:\app\Administrator\oradata\ORCL\CONTROL02.CTL D:\app\Administrator\oradata\ORCL
已复制 1 个文件。SQL> alter database mount;数据库已更改。
11.这里要用到之前生成的脚本,拷贝数据文件,修改文件位置。
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF';
alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF';
下面是执行结果
SQL> host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG D:\APP\ADMINISTRATOR\ORADATA\ORCL\
已复制 1 个文件。SQL> host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG D:\APP\ADMINISTRATOR\ORADATA\ORCL\
已复制 1 个文件。SQL> host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG D:\APP\ADMINISTRATOR\ORADATA\ORCL\
已复制 1 个文件。SQL> host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
已复制 1 个文件。SQL> host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
已复制 1 个文件。SQL> host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
已复制 1 个文件。SQL> host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
已复制 1 个文件。SQL> host copy C:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF D:\APP\ADMINISTRATOR\ORADATA\ORCL\
已复制 1 个文件。SQL> alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO01.LOG';数据库已更改。SQL> alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO02.LOG';数据库已更改。SQL> alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO03.LOG';数据库已更改。SQL> alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF';数据库已更改。SQL> alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF';数据库已更改。SQL> alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF';数据库已更改。SQL> alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF';数据库已更改。SQL> alter database rename file 'C:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF' to 'D:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF';数据库已更改。
12.打开数据库
SQL> alter database open;数据库已更改。
13.到这里还没有完全结束,还需要修改一下系统的注册表,环境变量
环境变量,删除原来C:\app\oracle\product\19.3\dbhome_1\bin
下面是注册表位置,第2次安装的目录是KEY_OraDB19Home2
\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOME0
下图位置需要新建个键值ORACLE_SID,内容为orcl
重启服务器测试自动启动是否OK,如果监听不好使,可以netcat重建一下,我这里有点问题就是实例注册不到监听,手动也不行,于是我就加了一个静态监听得了,在listener.ora里添加如下内容
SID_LIST_LISTENER =(SID_LIST =(SID_DESC =(GLOBAL_DBNAME = orcl)(ORACLE_HOME = D:\app\oracle\product\19.3\dbhome_1)(SID_NAME = orcl))
)
14.确实完毕后,删除原有C盘的ORACLE程序,在如下图路径中以管理员运行deinstall脚本,注意!!运行之后回车几下!!提示的时候你要输入“是”,他就会都删除
迁移方法2
通过方法1的迁移后,数据库现在运行在D盘,这里我再用mklink的方法把他弄到C盘去。
操作之前需要先把Oracle相关的服务全停了
剪切D盘的app整个目录到C盘根目录下,等待剪切完毕后,再执行如下命令,创建link
C:\Windows\system32>mklink /D d:\app c:\app
为 d:\app <<===>> c:\app 创建的符号链接
之后再启动系统服务,修改位置完毕。
(三)插曲
这里启动数据库时遇到个报错
Unable to obtain current patch information due to error: 20001, ORA-20001: Latest xml inventory is not loaded into table
ORA-06512: 在 "SYS.DBMS_QOPATCH", line 2327
ORA-06512: 在 "SYS.DBMS_QOPATCH", line 854
ORA-06512: 在 "SYS.DBMS_QOPATCH", line 937
ORA-06510: PL/SQL: 用户定义的异常错误未得到处理
ORA-06512: 在 "SYS.DBMS_QOPATCH", line 932
ORA-29913: 执行 ODCIEXTTABLEOPEN 调出时出错
ORA-29400: 数据插件错误KUP-04027: 文件名检查失败: qopatch_log.log
ORA-06512: 在 "SYS.DBMS_QOPATCH", line 919
ORA-06512: 在 "SYS.DBMS_QOPATCH", line 2286
ORA-06512: 在 "SYS.DBMS_QOPATCH", line 817
ORA-06512: 在 "SYS.DBMS_QOPATCH", line 2309
解决方案参考飞总的BLOG
ORA-20001: Latest xml inventory is not loaded into table – 提供7*24专业数据库(Oracle,SQL Server,MySQL,PostgreSQL等)恢复和技术支持@Tel:17813235971 - 惜分飞 (xifenfei.com)
我选择了方案1:
SQL> alter system set "_disable_directory_link_check"=true scope=spfile;
(四)总结
相对于方法1来说,方法2更简洁,实现步骤最少。
但是方法2搞完了,万一客户上去把目录链接删除了,又得挂了。。。。这个可真不好说。
下期我再写一篇Linux同样的问题,总有小白安装oracle照着网上教程来,直接装到/u01目录下(背景是装系统的人也没收到需求,装系统用默认分区,/50G,其余都到/HOME里了),以至于项目上线后根目录爆满系统停机,明明/home下有好几百个G的可用空间也没有利用上,我来说说Linux上如何解决。
也欢迎关注我的公众号【徐sir的IT之路】,一起学习!
————————————————————————————
公众号:徐sir的IT之路
CSDN :https://blog.csdn.net/xxddxhyz?type=blog
墨天轮:https://www.modb.pro/u/3605
PGFANS:https://www.pgfans.cn/user/home?userId=5568
————————————————————————————