如何重命名oracleDBname How to Rename DB_NAME with NID?

2024年 5月 13日 72.0k 0

rename database 重命名db,原DB_NAME=MACLEANS 需要修改为MACSH

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

 

 

SQL> startup mount;
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size 2228904 bytes
Variable Size 956304728 bytes
Database Buffers 687865856 bytes
Redo Buffers 7118848 bytes
Database mounted.

 

 
[oracle@mlab1 ~]$ nid target=system/oracle DBNAME=MACSH SETNAME=Y

DBNEWID: Release 11.2.0.3.0 – Production on Tue May 28 12:00:16 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to database MACLEANS (DBID=639200705)

Connected to server version 11.2.0

Control Files in database:
+DATA/macleansh/controlfile/current.272.816564929
+FRA/macleansh/controlfile/current.256.816564929

Change database name of database MACLEANS to MACSH? (Y/[N]) => Y

Proceeding with operation
Changing database name from MACLEANS to MACSH
Control File +DATA/macleansh/controlfile/current.272.816564929 – modified
Control File +FRA/macleansh/controlfile/current.256.816564929 – modified
Datafile +DATA/macleansh/datafile/system.260.81656479 – wrote new name
Datafile +DATA/macleansh/datafile/sysaux.266.81656479 – wrote new name
Datafile +DATA/macleansh/datafile/undotbs1.264.81656479 – wrote new name
Datafile +DATA/macleansh/datafile/users.273.81656479 – wrote new name
Datafile +DATA/macleansh/datafile/example.263.81656499 – wrote new name
Datafile +DATA/macleansh/tempfile/temp.262.81656497 – wrote new name
Control File +DATA/macleansh/controlfile/current.272.816564929 – wrote new name
Control File +FRA/macleansh/controlfile/current.256.816564929 – wrote new name
Instance shut down

Database name changed to MACSH.
Modify parameter file and generate a new password file before restarting.
Succesfully changed database name.
DBNEWID – Completed succesfully.

 
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size 2228904 bytes
Variable Size 956304728 bytes
Database Buffers 687865856 bytes
Redo Buffers 7118848 bytes

SQL> alter system set db_name=’MACSH’ scope=spfile;

System altered.

 

SQL> startup force;
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size 2228904 bytes
Variable Size 956304728 bytes
Database Buffers 687865856 bytes
Redo Buffers 7118848 bytes
Database mounted.
Database opened.

 

SQL> show parameter db_name

NAME TYPE VALUE
———————————— ———– ——————————
db_name string MACSH
SQL>
SQL>
SQL> select name from v$database;

NAME
———
MACSH

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论