8

oracle rac 集群文件目录迁移 -m6米乐安卓版下载

原创 2022-07-27
1480

一、rac 环境修改spfile位置

1. 从集群的任意一个实例登录,查看spfile信息

sql> show parameter spfile name type value ------------------------------------ ----------- ------------------------------ spfile string data/racdb/spfileracdb.ora'

2. 重新创建新的spfile

sql> create pfile = '/home/oracle/pfile.ora' from spfile; file created. sql> create spfile=' new_data' from pfile = '/home/oracle/pfile.ora'; file created.

3. 通过asm命令行,查看spfile,并赋予别名。

asmcmd> pwd new_data/racdb/parameterfile asmcmd> ls spfileracdb.ora.267.1085996147 asmcmd> mkalias new_data/racdb/parameterfile/spfileracdb.ora.267.1085996147 new_data/racdb/spfileracdb.ora

4. 修改注册新的spfile文件:

$ srvctl modify database -d racdb-p new_data/racdb/spfileracdb.ora

5. 重启数据库

$ srvctl stop database -d racdb $ srvctl start database -d racdb

6. 查看结果

sql> show parameter spfile name type value ------------------------------------ ----------- ------------------------------ spfile string new_data/racdb/spfileracdb.ora

7. 查看参数文件

cat initracdb2.ora spfile=' new_data/racdb/spfileracdb.ora' # line added by agent

二、控制文件路径修改

1、查看控制文件路径:

sql>col name for a50 sql> select status, name from v$controlfile; status name ------- -------------------------------------------------- data/racdb/control01.ctl data/racdb/control02.ctl 或 sql> show parameter control_files; name type value ------------------------------------ ----------- ------------------------------ control_files string data/racdb/control01.ctl, data/racdb/control02.ctl

2、关闭数据库所有实例,启动一个实例到nomount,用rman备份控制文件

sql>startup nomount; -- =>启库为nomount rman> restore controlfile to ' new_data/racdb/control01.ctl' from ' data/racdb/control01.ctl'; starting restore at 15-oct-21 using target database control file instead of recovery catalog allocated channel: ora_disk_1 channel ora_disk_1: sid=667 instance=racdb3 device type=disk channel ora_disk_1: copied control file copy finished restore at 15-oct-21 rman> restore controlfile to ' new_data/racdb/control02.ctl' from ' data/racdb/control02.ctl'; starting restore at 15-oct-21 using channel ora_disk_1 channel ora_disk_1: copied control file copy finished restore at 15-oct-21

3、复制控制文件使用:

asmcmd> cp new_data/racdb/controlfile/current.267.1086009349 control01.ctl copying new_data/racdb/controlfile/current.267.1086009349 -> new_data/racdb/control01.ctl asmcmd> cp new_data/racdb/controlfile/current.262.1086009391 control02.ctl copying new_data/racdb/controlfile/current.262.1086009391 -> new_data/racdb/control02.ctl

4、修改参数

sql> alter system set control_files=' new_data/racdb/control01.ctl', ' new_data/racdb/control02.ctl' scope=spfile sid='*'; system altered.

三、数据库表空间迁移

1、表空间迁移:

– 数据库系统表空间

rman> backup as copy tablespace system format ' new_data'; rman> switch tablespace system to copy; rman> backup as copy tablespace sysaux format ' new_data'; rman> switch tablespace sysaux to copy; rman> backup as copy tablespace users format ' new_data'; rman> switch tablespace users to copy;

– 业务用户表空间

rman> backup as copy tablespace tworain_dat format ' new_data'; rman> switch tablespace tworain_dat to copy;

– undo 表空间:

rman> backup as copy tablespace undotbs001 format ' new_data'; rman> switch tablespace undotbs001 to copy;

2、验证:

sql> select file_name from dba_data_files where tablespace_name ='system'; file_name -------------------------------------------------------------------------------- new_data/racdb/datafile/system.261.1086019835 sql> select file_name from dba_data_files where tablespace_name ='sysaux'; file_name -------------------------------------------------------------------------------- new_data/racdb/datafile/sysaux.260.1086019883 sql> select file_name from dba_data_files where tablespace_name ='users'; file_name -------------------------------------------------------------------------------- new_data/racdb/datafile/users.312.1086020021

3、temp 表空间,修改新路径:

sql> select name from v$tempfile; name -------------------------------------------------------------------------------- data/racdb/temp01.dbf data/racdb/temp02.dbf

4、 创建新temp 表空间

sql> create temporary tablespace temp03 tempfile ' new_data' size 30m autoextend on; tablespace created. sql> select name from v$tempfile; name -------------------------------------------------------------------------------- data/test/temp01.dbf data/test/temp02.dbf new_data/test/tempfile/temp03.311.1084007975

5、修改默认表空间:

sql> alter database default temporary tablespace temp03; database altered.

6、 删除旧表空间:

sql> drop tablespace temp including contents and datafiles;

四、redo 文件迁移

1、 创建新redo:

alter database add logfile thread 1 group 1 (' new_data') size 500m; alter database add logfile thread 1 group 2 (' new_data') size 500m; alter database add logfile thread 2 group 11 (' new_data') size 500m; alter database add logfile thread 2 group 12 (' new_data') size 500m; alter database add logfile thread 3 group 21 (' new_data') size 500m; alter database add logfile thread 3 group 22 (' new_data') size 500m; alter database add logfile thread 4 group 31 (' new_data') size 500m; alter database add logfile thread 4 group 32 (' new_data') size 500m;

2、 查看

select g.group#, g.status, l.member from v$log g left join v$logfile l on g.group#=l.group# where g.status = 'inactive' and l.member like ' data%' order by 2; group# status member ---------- ---------------- ---------------------------------------------------------------------- 16 inactive data/racdb/onlinelog/redo16.log 17 inactive data/racdb/onlinelog/redo17.log 18 inactive data/racdb/onlinelog/redo18.log 19 inactive data/racdb/onlinelog/redo19.log 20 inactive data/racdb/onlinelog/redo20.log 21 inactive data/racdb/onlinelog/redo21.log

3、 删除:

alter database drop logfile group 16; alter database drop logfile group 17; alter database drop logfile group 18; alter database drop logfile group 19; alter database drop logfile group 20;

五、数据文件迁移

sql> select file_id,file_name from dba_data_files where tablespace_name ='racdb_dat'; file_id file_name ---------- ---------------------------------------------------------------------------------------------------- 6 new_data/racdb/datafile/racdb_dat.265.1083955823 10 new_data/racdb/datafile/racdb_dat.262.1083956499 11 new_data/racdb/datafile/racdb_dat.261.1083956723 21 new_data/racdb/datafile/racdb_dat.267.1083955373 22 new_data/racdb/datafile/racdb_dat.301.1083964647 23 new_data/racdb/datafile/racdb_dat.268.1083958067 24 new_data/racdb/datafile/racdb_dat.269.1083958291

– rman 复制数据文件 :

copy datafile 10 to ' data'; copy datafile 11 to ' data'; copy datafile 21 to ' data';

– 修改控制文件,数据文件路径:

alter database rename file ' new_data/racdb/datafile/racdb_dat.265.1083955823' to ' data/racdb/datafile/racdb_dat.334.1085682389'; alter database rename file ' new_data/racdb/datafile/racdb_dat.262.1083956499' to ' data/racdb/datafile/racdb_dat.333.1085682705'; alter database rename file ' new_data/racdb/datafile/racdb_dat.261.1083956723' to ' data/racdb/datafile/racdb_dat.332.1085682719'; alter database rename file ' new_data/racdb/datafile/racdb_dat.267.1083955373' to ' data/racdb/datafile/racdb_dat.296.1085682739';

                         文章推荐

postgresql url
《课程笔记:postgresql深入浅出》之 初识postgresql(一) https://www.modb.pro/db/475817
《课程笔记:postgresql深入浅出》之 postgresql源码安装(二) https://www.modb.pro/db/475933
《课程笔记:postgresql深入浅出》之初始化postgresql(三) https://www.modb.pro/db/479524
《课程笔记:postgresql深入浅出》之psql管理工具-常用(四) https://www.modb.pro/db/479560
《课程笔记:postgresql深入浅出》之psql管理工具-高级命令(四) https://www.modb.pro/db/479559
《课程笔记:postgresql深入浅出》之内存与进程(五) https://www.modb.pro/db/489936
《课程笔记:postgresql深入浅出》之外存&永久存储(六) https://www.modb.pro/db/502267
oracle: url
《oracle 自动收集统计信息机制》 https://www.modb.pro/db/403670
《oracle_索引重建—优化索引碎片》 https://www.modb.pro/db/399543
《dba_tab_modifications表的刷新策略测试》 https://www.modb.pro/db/414692
《fy_recover_data.dbf》 https://www.modb.pro/doc/74682
《oracle rac 集群迁移文件操作.pdf》 https://www.modb.pro/doc/72985
《oracle date 字段索引使用测试.dbf》 https://www.modb.pro/doc/72521
《oracle 诊断案例 :因应用死循环导致的cpu过高》 https://www.modb.pro/db/483047
《oracle 慢sql监控脚本》 https://www.modb.pro/db/479620
《oracle 慢sql监控测试及监控脚本.pdf》 https://www.modb.pro/doc/76068
《oracle 脚本实现简单的审计功能》 https://www.modb.pro/db/450052
《记录一起索引rebuild与收集统计信息的事故》 https://www.modb.pro/db/408934
greenplum: url
《pl/java.pdf》 https://www.modb.pro/doc/70867
《gp的资源队列.pdf》 https://www.modb.pro/doc/67644
《greenplum psql客户端免交互执行sql.pdf》 https://www.modb.pro/doc/69806
                       欢迎赞赏支持或留言指正
最后修改时间:2022-09-27 21:33:39
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
2人已赞赏
z
【米乐app官网下载的版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

网站地图