首页 数据库 mysql教程 Oracle 修改dbid和dbname

Oracle 修改dbid和dbname

Jun 07, 2016 pm 04:48 PM
or

一般没人修改Oracle 的dbid和dbname,除非特殊情况,比如克隆数据库等等

一般没人修改Oracle 的dbid和dbname,除非特殊情况,,比如克隆数据库等等

步骤:

1.备份数据库

2.启动数据到mount状态

3.nid命令修改 (如果只是修改dbid,那么不需要dbname参数,需要更改dbname加上此参数即可,如果只修改dbname,那么需要setname参数为yes)

4.alter database open resetlogs打开数据库

nid语法以及参数含义:

Description of nid.gif follows


ParameterDescription

TARGET Specifies the username and password used to connect to the database. The user must have the SYSDBA privilege. If you are using operating system authentication, then you can connect with the slash (/). If the $ORACLE_HOME and $ORACLE_SID variables are not set correctly in the environment, then you can specify a secure (IPC or BEQ) service to connect to the target database. A target database must be specified in all invocations of the DBNEWID utility.

REVERT Specify YES to indicate that a failed change of DBID should be reverted (default is NO). The utility signals an error if no change DBID operation is in progress on the target database. A successfully completed change of DBID cannot be reverted. REVERT=YES is valid only when a DBID change failed.

DBNAME=new_db_name Changes the database name of the database. You can change the DBID and the DBNAME of a database at the same time. To change only the DBNAME, also specify the SETNAME parameter.

SETNAME Specify YES to indicate that DBNEWID should change the database name of the database but should not change the DBID (default is NO). When you specify SETNAME=YES, the utility writes only to the target database control files.

LOGFILE=logfile Specifies that DBNEWID should write its messages to the specified file. By default the utility overwrites the previous log. If you specify a log file, then DBNEWID does not prompt for confirmation.

APPEND Specify YES to append log output to the existing log file (default is NO).

HELP Specify YES to print a list of the DBNEWID syntax options (default is NO).

实例:

SQL> conn /as sysdba

Connected.

SQL> select dbid from v$database;

 

DBID

----------

148366931

SQL> startup mount;

ORACLE instance started.

 

Total System Global Area 5049942016 bytes

Fixed Size 2090880 bytes

Variable Size 1375733888 bytes

Database Buffers 3657433088 bytes

Redo Buffers 14684160 bytes

Database mounted.

SQL> exit

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

oracle@readerlogdb-> nid target=sys/sys@skyread

 

DBNEWID: Release 10.2.0.4.0 - Production on Mon Jul 1 11:16:09 2013

 

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

 

Connected to database SKYREAD (DBID=148366931)

 

Connected to server version 10.2.0

 

Control Files in database:

/database/oradata/skyread/control01.ctl

/database/oradata/skyread/control02.ctl

/database/oradata/skyread/control03.ctl

 

Change database ID of database SKYREAD? (Y/[N]) => y

 

Proceeding with operation

Changing database ID from 148366931 to 277140985

Control File /database/oradata/skyread/control01.ctl - modified

Control File /database/oradata/skyread/control02.ctl - modified

Control File /database/oradata/skyread/control03.ctl - modified

Datafile /database/oradata/skyread/system01.dbf - dbid changed

Datafile /database/oradata/skyread/tbs_test.dbf - dbid changed

Datafile /database/oradata/skyread/sysaux01.dbf - dbid changed

Datafile /database/oradata/skyread/users01.dbf - dbid changed

Datafile /database/oradata/skyread/system02.dbf - dbid changed

Datafile /database2/oradata/skyread/undotbs02.dbf - dbid changed

Datafile /database2/oradata/skyread/TBS_MRPMUSIC01.dbf - dbid changed

Datafile /database/oradata/skyread/sf01.dbf - dbid changed

Control File /database/oradata/skyread/control01.ctl - dbid changed

Control File /database/oradata/skyread/control02.ctl - dbid changed

Control File /database/oradata/skyread/control03.ctl - dbid changed

Instance shut down

 

Database ID for database SKYREAD changed to 277140985.

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 ID.

DBNEWID - Completed succesfully.

SQL> startup;

ORACLE instance started.

 

Total System Global Area 5049942016 bytes

Fixed Size 2090880 bytes

Variable Size 1375733888 bytes

Database Buffers 3657433088 bytes

Redo Buffers 14684160 bytes

Database mounted.

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

SQL> alter database open resetlogs;

Database altered.

SQL> select dbid from v$database;

DBID

----------

277140985

这里只是修改了dbid,其他的不再举例,有兴趣可以自己试验

 

本文永久更新链接地址:

linux

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
2 周前 By 尊渡假赌尊渡假赌尊渡假赌
仓库:如何复兴队友
4 周前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒险:如何获得巨型种子
3 周前 By 尊渡假赌尊渡假赌尊渡假赌

热门文章

R.E.P.O.能量晶体解释及其做什么(黄色晶体)
2 周前 By 尊渡假赌尊渡假赌尊渡假赌
仓库:如何复兴队友
4 周前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒险:如何获得巨型种子
3 周前 By 尊渡假赌尊渡假赌尊渡假赌

热门文章标签

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

减少在Docker中使用MySQL内存的使用 减少在Docker中使用MySQL内存的使用 Mar 04, 2025 pm 03:52 PM

减少在Docker中使用MySQL内存的使用

如何使用Alter Table语句在MySQL中更改表? 如何使用Alter Table语句在MySQL中更改表? Mar 19, 2025 pm 03:51 PM

如何使用Alter Table语句在MySQL中更改表?

mysql无法打开共享库怎么解决 mysql无法打开共享库怎么解决 Mar 04, 2025 pm 04:01 PM

mysql无法打开共享库怎么解决

什么是 SQLite?全面概述 什么是 SQLite?全面概述 Mar 04, 2025 pm 03:55 PM

什么是 SQLite?全面概述

在 Linux 中运行 MySQl(有/没有带有 phpmyadmin 的 podman 容器) 在 Linux 中运行 MySQl(有/没有带有 phpmyadmin 的 podman 容器) Mar 04, 2025 pm 03:54 PM

在 Linux 中运行 MySQl(有/没有带有 phpmyadmin 的 podman 容器)

在MacOS上运行多个MySQL版本:逐步指南 在MacOS上运行多个MySQL版本:逐步指南 Mar 04, 2025 pm 03:49 PM

在MacOS上运行多个MySQL版本:逐步指南

如何为MySQL连接配置SSL/TLS加密? 如何为MySQL连接配置SSL/TLS加密? Mar 18, 2025 pm 12:01 PM

如何为MySQL连接配置SSL/TLS加密?

哪些流行的MySQL GUI工具(例如MySQL Workbench,PhpMyAdmin)是什么? 哪些流行的MySQL GUI工具(例如MySQL Workbench,PhpMyAdmin)是什么? Mar 21, 2025 pm 06:28 PM

哪些流行的MySQL GUI工具(例如MySQL Workbench,PhpMyAdmin)是什么?

See all articles