首页 > 数据库 >nid 更改oracle 实例名

nid 更改oracle 实例名

时间:2024-04-12 17:33:46浏览次数:25  
标签:name dbid changed nid ORCL 实例 oracle new

1、关闭数据库启动到mout

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

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、启动数据库

 

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/orapworcl password=oracle entries=5 force=y  format=12

 

标签:name,dbid,changed,nid,ORCL,实例,oracle,new
From: https://www.cnblogs.com/omsql/p/18131764

相关文章

  • oracle数据库listagg、wm_concat、xmlagg的用法
    1.listaggLISTAGG(measure_expr:any[,delimiter_expr:VARCHAR])WITHINGROUP(ORDERBYcolumn_exprASC/DESC)语法注解LISTAGG函数一般配合GROUPBY作为聚合函数(也可用于开窗函数)使用,可以传入两个参数变量measure_expr:要合并处理的字段delimiter_expr:给定分隔符号......
  • Oracle关于半连接SQL执行计划的执行路径一些有趣的实验
     Oracle关于半连接SQL执行计划的执行路径一些有趣的实验 从摩天轮的问答里边看到的一个问题,https://www.modb.pro/issue/34573大概有这么条SQL(包括环境构造语句),如何强制走出nestedloops的执行路径。createtabletb1asselect*fromdba_objects;createtabletb2as......
  • 【Springboot】排除多余依赖与Bean实例
    一、背景:引入公共包之后,需要排除部分不需要的包和bean,给当前服务最大程度减重二、实现:1.在pom.xml排除依赖 2.在启动类上添加扫描排除项@ComponentScan(basePackages={"com.xxx"},excludeFilters={@ComponentScan.Filter(type......
  • Oracle 实现多语言(即根据用户登录的环境自适应本地语言)
    CREATEORREPLACEPACKAGEBODYOADBA.db_globalIS--設定參數值PROCEDUREset_value(parameterVARCHAR2,valVARCHAR2)ISBEGINDBMS_SESSION.set_context('db_context',parameter,val);ENDset_value;--取得參數值FUNCTION......
  • 从 Oracle 到 MySQL 数据库的迁移之旅
    目录引言一、前期准备工作1.搭建新的MySQL数据库2.建立相应的数据表2.1数据库兼容性分析2.1.1字段类型兼容性分析2.1.2函数兼容性分析2.1.3是否使用存储过程?存储过程的个数?复杂度?2.1.4是否使用触发器?个数?使用的场景?2.2建表过程中其他需要注意的事项3.为项目配置Oracle和MyS......
  • 【Shell】if选择结构语法实例
    if结构用于在Shell脚本中进行判定。如果指定的条件为真,则执行指定的命令。if和then若写在同一行,then与语句之间要使用分号“;”隔开。if语句结构一定要以“fi”结尾。1.单分支结构语法格式ifconditionthencommand1command2...commandNfi......
  • 2024年阿里云2核2G服务器价格揭晓:3M带宽经济型e实例仅需99元/年
    在当今这个数字化高速发展的时代,云服务器已成为企业和个人不可或缺的基础设施。阿里云,作为国内领先的云服务提供商,一直以其稳定、高效、安全的服务而备受用户青睐。今天,我要为大家介绍的是阿里云的一款超值优惠产品——2核2G3M经济型e实例云服务器ECS,仅需99元即可享有一年服务!......
  • 通过实例学C#之Thread类
    构造函数Thread(ThreadStart)该构造函数接受一个不带参数的方法。staticvoidMain(string[]args){Threadt1=newThread(newThreadStart(ThreadMethod1));t1.Start();Console.ReadKey();}staticvoidThreadMethod1(){for(inti=0;i<5......
  • MySQL 06 mysql 如何实现类似 oracle 的 merge into
    拓展阅读MySQLViewMySQLtruncatetable与delete清空表的区别和坑MySQLRulermysql日常开发规范MySQLdatetimetimestamp以及如何自动更新,如何实现范围查询MySQL06mysql如何实现类似oracle的mergeintoMySQL05MySQL入门教程(MySQLtutorialbook)MySQL04-E......
  • 解析oracle的DDL语句生成高斯内表及表字段主键配置
    oracle的DDL语句如下:CREATETABLETPPROD.CONFIG( NOVARCHAR2(50), CONFIGCODEVARCHAR2(400), CONFIGVALUEVARCHAR2(400), CONSTRAINTPK_GUENDORASSISTCONFIGPRIMARYKEY(NO,CONFIGCODE));CREATEUNIQUEINDEXPK_GUENDORASSISTCONFIGONTPPROD.GUENDORASSI......