虚拟化容器,大数据,DBA,中间件,监控。

Oracle对pdb进行重命名(改名)

29 12月
作者:admin|分类:DBA运维

脚本

-- 步骤1、启动pdb到受限模式(在pdb里边操作) alter session set container=pdblhr3; alter pluggable database pdblhr3 close immediate; alter pluggable database pdblhr3 open restricted; -- 或: shutdown immediate startup open restrict -- 步骤2、进入pdb里边对pdb进行重命名 alter session set container=pdblhr3; select * from global_name; alter pluggable database pdblhr3 rename global_name to pdbprod3; -- 步骤3、正常关闭和启动pdb alter pluggable database close immediate; alter pluggable database open; -- 或 shutdown immediate startup
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 -- 步骤1、启动pdb到受限模式(在pdb里边操作) alter session set container =pdblhr3; alter pluggable database pdblhr3 close immediate; alter pluggable database pdblhr3 open restricted;   -- 或: shutdown immediate startup open restrict   -- 步骤2、进入pdb里边对pdb进行重命名 alter session set container =pdblhr3; select * from global_name; alter pluggable database pdblhr3 rename global_name to pdbprod3;   -- 步骤3、正常关闭和启动pdb alter pluggable database close immediate; alter pluggable database open;   -- 或 shutdown immediate startup

例如:将JDE重命名为JDEPROD

alter pluggable database JDE close immediate; alter pluggable database JDE open restricted; alter session set container=JDE; alter pluggable database rename global_name to JDEPROD; alter pluggable database close immediate; alter pluggable database open;
1 2 3 4 5 6 alter pluggable database JDE close immediate; alter pluggable database JDE open restricted; alter session set container =JDE; alter pluggable database rename global_name to JDEPROD; alter pluggable database close immediate; alter pluggable database open;

注意事项

1、必须进入目标PDB中才可以对其进行重命名,否则报错“ORA-65046: operation not allowed from outside a pluggable database”。

2、在修改完成后,监听里的service_name已经自动被修改了。所以,如果配置了相关的tnsnames.ora文件,那么就需要同时手工去修改该文件。

相关文章


浏览366 评论0
返回
目录
返回
首页
mysql日志文件undo log和redo log设置与详细讲解 Oracle文本数据(csv、txt)导出方法总结