码迷,mamicode.com
首页 > 数据库 > 详细

win64 bit oracle11gR2修改SID和dbname

时间:2016-07-11 19:13:04      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:

查看数据库情况:
C:\>set oracle_sid=bdup

C:\>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 4月 10 08:55:42 2014

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

已连接到空闲例程。

SQL> startup
ORACLE 例程已经启动。

Total System Global Area 1235959808 bytes
Fixed Size                  2175288 bytes
Variable Size             956305096 bytes
Database Buffers          268435456 bytes
Redo Buffers                9043968 bytes
数据库装载完毕。
数据库已经打开。
SQL> show parameter instance
NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- --------
active_instance_count                integer
cluster_database_instances           integer                1
instance_groups                      string
instance_name                        string                 bdup
instance_number                      integer                0
instance_type                        string                 RDBMS
open_links_per_instance              integer                4
parallel_instance_group              string
parallel_server_instances            integer                1
SQL> shutdown immediate
新的sid为wtest,新的数据库名为wtest。
1.重新创建windows下的实例服务
C:\>oradim -NEW -SID wtest -startmode manual
实例已创建。
2.修改相关的目录
数据文件,控制文件,日志文件存放目录:D:\oradata\bdup --->wtest
C:\app\Administrator\admin\bdup\adump  --->wtest
C:\app\Administrator\diag\rdbms\bdup\bdup   --->wtest
C:\app\Administrator\product\11.2.0\dbhome_1\database
C:\app\Administrator\product\11.2.0\dbhome_1\database>dir
C:\app\Administrator\product\11.2.0\dbhome_1\database 的目录
2014/03/06  11:28             2,048 hc_bdup.dat   ---->hc_wtest.dat
2014/01/15  22:03             2,048 hc_orcl.dat
2014/03/06  08:50             1,203 initbdup.ora ----->initwtest.ora
2014/03/18  15:34             1,149 INITorcl.ORA
2005/12/22  04:07            31,744 oradba.exe
2014/04/10  09:14             7,405 oradim.log
2014/03/05  10:52             2,560 PWDbdup.ora  ------>PWDwtest.ora
2014/03/18  17:27             2,560 PWDhjj.ora
2014/03/29  21:47             1,536 PWDorcl.ora
2014/03/04  15:24       104,858,112 REDO04.LOG
2014/03/04  15:24       104,858,112 REDO05.LOG
2014/03/18  10:58         9,748,480 SNCFORCL.ORA
2014/04/10  08:56            13,824 SPFILEBDUP.ORA ------>SPFILEWTEST.ORA
2014/04/05  13:59             3,584 SPFILEORCL.ORA
3.修改参数文件
C:\app\Administrator\product\11.2.0\dbhome_1\database目录下修改initwtest.ora
wtest.__db_cache_size=285212672
wtest.__java_pool_size=16777216
wtest.__large_pool_size=16777216
wtest.__oracle_base=‘C:\app\Administrator‘#ORACLE_BASE set from environment
wtest.__pga_aggregate_target=419430400
wtest.__sga_target=822083584
wtest.__shared_io_pool_size=0
wtest.__shared_pool_size=469762048
wtest.__streams_pool_size=16777216
*.audit_file_dest=‘C:\app\Administrator\admin\wtest\adump‘
*.audit_trail=‘db‘
*.compatible=‘11.2.0.0.0‘
*.control_file_record_keep_time=7
*.control_files=‘D:\oradata\wtest\control01.ctl‘,‘D:\oradata\wtest\control02.ctl‘
*.db_block_size=8192
*.db_domain=‘‘
*.db_name=‘wtest‘
*.db_recovery_file_dest=‘C:\app\Administrator\flash_recovery_area\wtest‘
*.db_recovery_file_dest_size=4102029312
*.diagnostic_dest=‘C:\app\Administrator‘
*.dispatchers=‘(PROTOCOL=TCP) (SERVICE=wtestXDB)‘
*.fast_start_mttr_target=90
*.job_queue_processes=1000
*.memory_target=1232076800
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile=‘EXCLUSIVE‘
*.sga_target=587202560
*.undo_tablespace=‘UNDOTBS1‘
4.启动数据库
C:\>set oracle_sid=wtest

C:\>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 10 10:58:36 2014

Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.

Total System Global Area 1235959808 bytes
Fixed Size                  2175288 bytes
Variable Size             939527880 bytes
Database Buffers          285212672 bytes
Redo Buffers                9043968 bytes
ORA-01103: database name ‘BDUP‘ in control file is not ‘WTEST‘
SQL> show parameter instance_name
NAME                                 TYPE                              VALUE
------------------------------------ --------------------------------- ------
instance_name                        string                            wtest
SQL> select instance_name,status from v$instance;
INSTANCE_NAME                                    STATUS
------------------------------------------------ --------
wtest                                            STARTED
至此SID已经修改成wtest了,但是DB_NAME还是BDUP,需要重建控制文件
5.重建控制文件
C:\>set oracle_sid=orcl
C:\>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu Apr 10 11:04:42 2014

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> alter database backup controlfile to trace  as ‘D:\oradata\wtest\aa.ctl‘;

Database altered.
在aa.ctl文件中找到如下内容:
CREATE CONTROLFILE SET DATABASE "WTEST" RESETLOGS NOARCHIVELOG
    MAXLOGFILES 16
    MAXLOGMEMBERS 3
    MAXDATAFILES 100
    MAXINSTANCES 8
    MAXLOGHISTORY 292
LOGFILE
  GROUP 1 ‘D:\oradata\wtest\REDO01.LOG‘  SIZE 50M BLOCKSIZE 512,
  GROUP 2 ‘D:\oradata\wtest\REDO02.LOG‘  SIZE 50M BLOCKSIZE 512,
  GROUP 3 ‘D:\oradata\wtest\REDO03.LOG‘  SIZE 50M BLOCKSIZE 512
DATAFILE
 ‘D:\oradata\wtest\SYSTEM01.DBF‘,
 ‘D:\oradata\wtest\SYSAUX01.DBF‘,
 ‘D:\oradata\wtest\UNDOTBS01.DBF‘,
 ‘D:\oradata\wtest\USERS01.DBF‘,
 ‘D:\oradata\wtest\EXAMPLE01.DBF‘,
 ‘D:\oradata\wtest\TBS01.DBF‘,
 ‘D:\oradata\wtest\UNDOTBS02.DBF‘,
 ‘D:\oradata\wtest\RMAN_TBS01.DBF‘
CHARACTER SET AL32UTF8;
ALTER DATABASE OPEN RESETLOGS;
ALTER TABLESPACE TEMP ADD TEMPFILE ‘D:\oradata\wtest\TEMP01.DBF‘ SIZE 30408704  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;
将如上内容保存成ctl.sql
SQL>SQL> @D:\oradata\wtest\ctl.sql;
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL> create spfile from pfile;
File created.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ WRITE
SQL> show parameter db_name
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      WTEST
SQL> show parameter instance_name
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      wtest
SQL> show parameter control
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time        integer     7
control_files                        string      D:\ORADATA\WTEST\CONTROL01.CTL
                                                 , D:\ORADATA\WTEST\CONTROL02.C
                                                 TL
control_management_pack_access       string      DIAGNOSTIC+TUNING
至此DB_NAME也修改过来了。

win64 bit oracle11gR2修改SID和dbname

标签:

原文地址:http://www.cnblogs.com/guys-hero/p/5661248.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!