网络编程
位置:首页>> 网络编程>> 数据库>> oracle 更改数据库名的方法(4)

oracle 更改数据库名的方法(4)

 来源:asp之家 发布时间:2009-10-24 18:20:00 

标签:oracle,数据库

9. 发现v$instance里的没有修改过来,这是因为在windows平台,继续如下操作
********如果是windows平台,v$instance里的instanc_name没有变, 继续如下操作
passwd文件通常放在oracle_home/database目录下,文件命名形式为PWDsid.ora,sid为实例名(Service_name),
如当前的数据库名及service_name为orcl,则passwd文件为PWDorcl.ora
C:\Documents and Settings\Administrator>orapwd file=D:\oracle\product\10.2.0\db_
1\database\PWDdborcl.ora password=aibo entries=5
要注意一下,此时虽然数据库名已经改成dborcl了,但instance_name还是orcl,所以,passwd文件必须跟以前一样。否则会出错。
10. 删除以前的实例orcl
C:\Documents and Settings\Administrator>oradim -delete -sid orcl
实例已删除。
11. 创建新的实例名 dborcl
C:\Documents and Settings\Administrator>oradim -new -sid dborcl -intpwd aibo -st
artmode a -pfile D:\oracle\product\10.2.0\pfile20091022.ora
OPW-00005: 存在相同名称的文件 - 请删除或重命名
实例已创建。
12.
C:\Documents and Settings\Administrator>set oracle_sid=dborcl
C:\Documents and Settings\Administrator>sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 10月 22 13:41:12 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> quit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
13.检查服务名
C:\Documents and Settings\Administrator>lsnrctl reload
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 22-10月-2009 13:4
3:13
Copyright (c) 1991, 2005, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.56)(PORT=1521)))
命令执行成功
C:\Documents and Settings\Administrator>sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 10月 22 13:43:21 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select open_mode from v$database;
OPEN_MODE
----------
READ WRITE
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
dborcl
SQL> show parameter name;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert string
db_name string dborcl
db_unique_name string dborcl
global_names boolean FALSE
instance_name string dborcl
lock_name_space string
log_file_name_convert string
service_names string dborcl
SQL> quit
从 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options 断开
检查service是否被更改
C:\Documents and Settings\Administrator>tnsping dborcl
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 22-10月-
2009 13:50:00
Copyright (c) 1997, 2005, Oracle. All rights reserved.
已使用的参数文件:
D:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora
已使用 EZCONNECT 适配器来解析别名
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=dborcl.gdgg.local
))(ADDRESS=(PROTOCOL=TCP)(HOST=202.106.195.30)(PORT=1521)))
^C
测试不通过,说明dborcl配置有问题
修改tnsnames.ora文件,添加如下内容:
×××××××××××××××××××××××××××××××××××××××××××××××××××××
DBORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.56)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = dborcl)
)
)
×××××××××××××××××××××××××××××××××××××××××××××××××××××
--重启监听
C:\Documents and Settings\Administrator>lsnrctl reload
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 22-10月-2009 13:5
0:46
Copyright (c) 1991, 2005, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.56)(PORT=1521)))
命令执行成功
---在测试
C:\Documents and Settings\Administrator>tnsping dborcl
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 22-10月-
2009 13:52:18
Copyright (c) 1997, 2005, Oracle. All rights reserved.
已使用的参数文件:
D:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora
已使用 TNSNAMES 适配器来解析别名
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.
2.56)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dborcl)
))
OK (20 毫秒)
到此所有的 数据库名(db_name)及实例名(Instance_name or Service_name) ,都已经更改

0
投稿

猜你喜欢

手机版 网络编程 asp之家 www.aspxhome.com