nid 更改oracle 实例名
1、关闭数据库启动到mout
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | SQL> shut immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> SQL> startup mount ORACLE instance started. Total System Global Area 3.5568E+10 bytes Fixed Size 37245408 bytes Variable Size 4294967296 bytes Database Buffers 3.1139E+10 bytes Redo Buffers 96968704 bytes Database mounted. |
2、备份spfile
create pfile='/home/oracle/pfile0412' from spfile;
3、nid修改数据库实例
nid target=sys/oracle DBNAME=ncctest LOGFILE=/home/oracle/nid.log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | cat nid.log DBNEWID: Release 19.0.0.0.0 - Production on Fri Apr 12 16:58:49 2024 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. Connected to database ORCL (DBID=1689820245) Connected to server version 19.18.0 Control Files in database: /oracle/ORCL/control01.ctl /oracle/ORCL/control02.ctl Changing database ID from 1689820245 to 2514432329 Changing database name from ORCL to NCCTEST Control File /oracle/ORCL/control01.ctl - modified Control File /oracle/ORCL/control02.ctl - modified Datafile /oracle/ORCL/system01.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_index001.db - dbid changed, wrote new name Datafile /oracle/ORCL/sysaux01.db - dbid changed, wrote new name Datafile /oracle/ORCL/undotbs01.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data001.db - dbid changed, wrote new name Datafile /oracle/ORCL/users01.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data002.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data003.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data004.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_index002.db - dbid changed, wrote new name Datafile /oracle/ORCL/undotbs02.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data005.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data006.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data007.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data008.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data009.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data010.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data011.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data012.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data013.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data014.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data015.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data016.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data017.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_data018.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_index003.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_index004.db - dbid changed, wrote new name Datafile /oracle/ORCL/nnc_index005.db - dbid changed, wrote new name Datafile /oracle/ORCL/temp01.db - dbid changed, wrote new name Datafile /oracle/ORCL/temp02.db - dbid changed, wrote new name Control File /oracle/ORCL/control01.ctl - dbid changed, wrote new name Control File /oracle/ORCL/control02.ctl - dbid changed, wrote new name Instance shut down Database name changed to NCCTEST. Modify parameter file and generate a new password file before restarting. Database ID for database NCCTEST changed to 2514432329. All previous backups and archived redo logs for this database are unusable. Database has been shutdown, open database with RESETLOGS option. Succesfully changed database name and ID. DBNEWID - Completed succesfully. |
4、修改pfile
使用vi %s#orcl#ncctest
5、修改.bash_profile
修改oracle_sid
################OracleBegin#########################
umask 022
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/db
export ORACLE_SID=ncctest
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
#export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
#export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export LANG=en_US.UTF-8
export PS1=`hostname`'<$PWD>$'
export CV_ASSUME_DISTID=RHEL7.6
################OracleEnd#########################
source .bash_profile
6、启动数据库
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | SQL> startup pfile= '/home/oracle/pfile0412' ; ORACLE instance started. Total System Global Area 3.5568E+10 bytes Fixed Size 37245408 bytes Variable Size 4294967296 bytes Database Buffers 3.1139E+10 bytes Redo Buffers 96968704 bytes Database mounted. ORA-01589: must use RESETLOGS or NORESETLOGS option for database open SQL> alter database open NORESETLOGS; alter database open NORESETLOGS * ERROR at line 1: ORA-01588: must use RESETLOGS option for database open SQL> alter database open RESETLOGS; Database altered. |
7、创建密码文件
orapwd file=$ORACLE_HOME/dbs/orapwncctest password=oracle entries=5 force=y format=12
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)