修改數據庫實例名及數據庫名

来源:互联网 发布:杭盖乐队 知乎 编辑:程序博客网 时间:2024/06/03 08:18
今天做了个测试修改数据库的实例名及数据库名,亲们,无论做测试还是商用环境都要做好备份,所谓备份乃安全第一重要因素!

DBSUPPORTDB to YCDATADB

步骤如下:
1.startup mount;
2.create pfile from spfile; 
3. nid target=sys/syspwd@DBSUPPORTDB dbname=YCDATADB    (提示時輸入Y)


Connected to database DBSUPPORTDB (DBID=775344151)


Connected to server version 10.2.0


Control Files in database:
    /u02/app/oracle/oradata/DBSUPPORTDB/control01.ctl
    /u02/app/oracle/oradata/DBSUPPORTDB/control02.ctl
    /u02/app/oracle/oradata/DBSUPPORTDB/control03.ctl


Change database ID and database name DBSUPPORTDB to YCDATADB? (Y/[N]) => Y


Proceeding with operation
Changing database ID from 775344151 to 2615727020
Changing database name from DBSUPPORTDB to YCDATADB
    Control File /u02/app/oracle/oradata/DBSUPPORTDB/control01.ctl - modified
    Control File /u02/app/oracle/oradata/DBSUPPORTDB/control02.ctl - modified
    Control File /u02/app/oracle/oradata/DBSUPPORTDB/control03.ctl - modified
    Datafile /u02/app/oracle/oradata/DBSUPPORTDB/system01.dbf - dbid changed, wrote new name
    Datafile /u02/app/oracle/oradata/DBSUPPORTDB/undotbs01.dbf - dbid changed, wrote new name
    Datafile /u02/app/oracle/oradata/DBSUPPORTDB/sysaux01.dbf - dbid changed, wrote new name
    Datafile /u02/app/oracle/oradata/DBSUPPORTDB/users01.dbf - dbid changed, wrote new name
    Datafile /u02/app/oracle/oradata/DBSUPPORTDB/users02.dbf - dbid changed, wrote new name
    Datafile /u03/vdisk1/smtdata01.dbf - dbid changed, wrote new name
    Datafile /u03/vdisk2/smtindex01.dbf - dbid changed, wrote new name
    Datafile /u03/vdisk1/perfstat.dbf - dbid changed, wrote new name
    Datafile /u02/app/oracle/oradata/DBSUPPORTDB/temp01.dbf - dbid changed, wrote new name
    Control File /u02/app/oracle/oradata/DBSUPPORTDB/control01.ctl - dbid changed, wrote new name
    Control File /u02/app/oracle/oradata/DBSUPPORTDB/control02.ctl - dbid changed, wrote new name
    Control File /u02/app/oracle/oradata/DBSUPPORTDB/control03.ctl - dbid changed, wrote new name
    Instance shut down


Database name changed to YCDATADB.
Modify parameter file and generate a new password file before restarting.
Database ID for database YCDATADB changed to 2615727020.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database name and ID.
DBNEWID - Completed succesfully.


4. orapwd file=/u02/app/oracle/product/10.2.0/db_1/dbs/orapwYCDATADB password=sysadmin entries=5;
5.export ORACLE_SID=YCDATADB
6.cp initDBSUPPORTDB.ora initYCDATADB.ora 
7.vim initYCDATADB.ora
7-1.修改該DB_NAME (和INSTANCE_NAME)
8..bash_profile  -> DBSUPPORTDB=>YCDATADB
9.alter database open resetlogs;


optional


10.tnsnames.ora
11.create spfile from pfile;
0 0
原创粉丝点击