ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 数据库更改DB NAME

数据库更改DB NAME

原创 Linux操作系统 作者:howard_zhang 时间:2008-09-25 15:41:43 0 删除 编辑


shutdown immediate

startup mount

$ nid TARGET=sys/system DBNAME=mdcl SETNAME=YES

DBNEWID: Release 10.2.0.1.0 - Production on Thu Sep 25 15:20:43 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to database TEST (DBID=1963287947)

Connected to server version 10.2.0

Control Files in database:
    /oradata/control01.ctl
    /oradata/control02.ctl
    /oradata/control03.ctl

Change database name of database TEST to MDCL? (Y/[N]) => y

Proceeding with operation
Changing database name from TEST to MDCL
    Control File /oradata/control01.ctl - modified
    Control File /oradata/control02.ctl - modified
    Control File /oradata/control03.ctl - modified
    Datafile /oradata/system01.dbf - wrote new name
    Datafile /oradata/undotbs01.dbf - wrote new name
    Datafile /oradata/sysaux01.dbf - wrote new name
    Datafile /oradata/users01.dbf - wrote new name
    Datafile /oradata/bigfile.dbf - wrote new name
    Datafile /oradata/temp01.dbf - wrote new name
    Control File /oradata/control01.ctl - wrote new name
    Control File /oradata/control02.ctl - wrote new name
    Control File /oradata/control03.ctl - wrote new name
    Instance shut down

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

$

sqlplus / as sysdba

shutdown immediate

SQL> startup mount
ORACLE instance started.

Total System Global Area 1207959552 bytes
Fixed Size                  2020456 bytes
Variable Size             318770072 bytes
Database Buffers          872415232 bytes
Redo Buffers               14753792 bytes
ORA-01103: database name 'MDCL' in control file is not 'TEST'  ===如下错误

SQL> show parameter db_name

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
db_name                              string
test

创建pfile

create pfile from spfile;

注意将PFILE修改为initmdcl.ora

shutdown immediate

 


建立新的用户密码

$ orapwd file=pwdmdcl.ora password=system entries=10

SQL> startup
ORACLE instance started.

Total System Global Area 1207959552 bytes
Fixed Size                  2020456 bytes
Variable Size             318770072 bytes
Database Buffers          872415232 bytes
Redo Buffers               14753792 bytes
Database mounted.
Database opened.
SQL> show parameter name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string
db_name                              string      MDCL
db_unique_name                       string      MDCL
global_names                         boolean     FALSE
instance_name                        string      mdcl
lock_name_space                      string
log_file_name_convert                string
service_names                        string      MDCL
SQL>


修改数据库名字完成!

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7882490/viewspace-464335/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: 表空间传输
请登录后发表评论 登录
全部评论

注册时间:2008-01-22

  • 博文量
    42
  • 访问量
    142754