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

今天做了个测试修改数据库的实例名及数据库名,亲们,无论做测试还是商用环境都要做好备份,所谓备份乃安全第一重要因素!

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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值