In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
It is described in two stages, the first stage is to change sid, and the second stage is to change dbname. The following detailed steps are described below: first, change sid 1, log in to the database and view the previous sid, a total of three steps
[oracle@localhost ~] $sqlplus "/ as sysdba" SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 9 05:53:08 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL > startup ORACLE instance started. Total System Global Area 539848704 bytes Fixed Size 1337748 bytes Variable Size 360711788 bytes Database Buffers 171966464 bytes Redo Buffers 5832704 bytes Database mounted. Database opened. SQL > select instance from v$thread; INSTANCE-orcl 2, close the database [sql] view plaincopyprint?SQL > shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. SQL > exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
3. Edit the / etc/oratab file and replace all orcl with mzh [oracle@localhost ~] $vim / etc/oratab
4. Change the oracle user's .bash _ profile file
[oracle@localhost ~] $vim .bash _ profile
5. Make the modified .bash_profile file effective:% s/oral/mzh/g
[oracle@localhost] $. .bash _ profile 7, view system environment variables
[oracle@localhost ~] $env | grep ORACLE ORACLE_SID=mzhORACLE_BASE=/u01/appORACLE_HOME=/u01/app/oracle
The effect is generated. 8. Go to $ORACLE_HOME/dbs to check the directory and see those with orcl
[oracle@localhost] $cd $ORACLE_HOME/dbs [oracle@localhost dbs] $ll total 64 lkHXY-rw-r- RW oracle oinstall 24 Aug 8 06:46 lkHXY-rw-r- 1 oracle oinstall 24 Jun 29 00:35 hc_DBUA0.dat-rw-rw---- 1 oracle oinstall 1544 Aug 9 05:56 hc_mzh.dat-rw-r--r-- 1 oracle oinstall 2851 May 15 2009 init.ora-rw-r- 1 oracle oinstall 24 Aug 8 06:46 lkHXY-rw-r- 00:47 lkMZH-rw-r- 1 oracle oinstall 2048 Aug 9 06:09 orapwmzhdrwx- 2 oracle oinstall 4096 Jun 28 22:50 peshm_DBUA0_0drwx- 2 oracle oinstall 4096 Aug 8 06:45 peshm_hxy_0drwx- 2 oracle oinstall 4096 Jun 28 23:02 peshm_mzh_0-rw-r- 1 oracle oinstall 3584 Aug 9 05:53 spfilemzh.ora9 、 Change the file name orcr > > mzh ORCL > > MZH, the command is as follows:
[oracle@localhost dbs] $mv hc_orcl.dat hc_mzh.dat [oracle@localhost dbs] $mv orapworcl orapwmzh [oracle@localhost dbs] $mv lkORCL lkMZH [oracle@localhost dbs] $mv peshm_orcl_0/ peshm_mzh_0/ [oracle@localhost dbs] $mv spfileorcl.ora spfilemzh.ora 10, generate password file again And check and note that it is best to delete the original [oracle@localhost dbs] $orapwd file=$ORACLE_HOME/dbs/orapw$ORACLE_SID password=sys entries=5 force=y [oracle@localhost dbs] $ls-lrt orap*-rw-r- 1 oracle oinstall 2048 Aug 9 06:09 orapwmzh
11. Log in to the database and check the instance name. The result shows that sid has changed from orcl to mzh.
[oracle@localhost dbs] $sqlplus "/ as sysdba" Connected to an idle instance. SQL > startup ORACLE instance started. Total System Global Area 539848704 bytes Fixed Size 1337748 bytes Variable Size 327157356 bytes Database Buffers 205520896 bytes Redo Buffers 5832704 bytes Database mounted. Database opened. SQL > select instance from v$thread; INSTANCE-mzh
Go on to the second part, change the database name dbname2.1 backup control file
SQL > alter database backup controlfile to trace resetlogs; Database altered. 2.2 close and exit the database
SQL > shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. The backup directory for control files of SQL > exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-Production With the Partitioning, OLAP, Data Mining and Real Application Testing options 2.3 orcale 11.2g is / u01/app/oracle/diag/rdbms/mzh/mzh/trace
[oracle@localhost trace] $ls-lrt [oracle@mazh dbs] $ls / u01/app/diag/rdbms/mzh/mzh/trace-lrthtotal 116K oracle oinstall r-1 oracle oinstall 259 Aug 8 06:45 mzh_ora_4808.trm-rw-r- 1 oracle oinstall 15K Aug 8 06:45 mzh_ora_4808.trc-rw-r- 1 oracle oinstall 57 Aug 8 06:46 mzh_mman_4845.trm-rw-r- 1 Oracle oinstall 796 Aug 8 06:46 mzh_mman_4845.trc-rw-r- 1 oracle oinstall 57 Aug 8 06:46 mzh_dbrm_4839.trm-rw-r- 1 oracle oinstall 839 Aug 8 06:46 mzh_dbrm_4839.trc-rw-r- 1 oracle oinstall 57 Aug 8 06:46 mzh_mmon_4857.trm-rw-r- 1 oracle oinstall 833 Aug 8 06:46 mzh_mmon_4857.trc-rw-r- -1 oracle oinstall 67 Aug 8 06:46 mzh_j004_4909.trm-rw-r- 1 oracle oinstall 912 Aug 8 06:46 mzh_j004_4909.trc-rw-r- 1 oracle oinstall 112 Aug 8 06:47 mzh_j000_4900.trm-rw-r- 1 oracle oinstall 2.8K Aug 8 06:47 mzh_j000_4900.trc-rw-r- 1 oracle oinstall 67 Aug 8 06:58 mzh_ckpt_4851 .trm-rw-r- 1 oracle oinstall 905 Aug 8 06:58 mzh_ckpt_4851.trc-rw-r- 1 oracle oinstall 78 Aug 8 06:58 mzh_j000_5233.trm-rw-r- 1 oracle oinstall 1.8K Aug 8 06:58 mzh_j000_5233.trc-rw-r- 1 oracle oinstall 57 Aug 8 08:04 mzh_j000_7066.trm-rw-r- 1 oracle oinstall 1.1K Aug 8 08:04 mzh_j000_7066.trc-rw-r- 1 oracle oinstall 139 Aug 8 08:43 mzh_vktm_4831.trm-rw-r- 1 oracle oinstall 1.9K Aug 8 08:43 mzh_vktm_4831.trc-rw-r- 1 oracle oinstall 407 Aug 8 08:43 mzh_ora_4871.trm-rw-r- 1 oracle oinstall 6.3K Aug 8 08:43 mzh_ora_4871.trc-rw-r- -1 oracle oinstall 6.2K Aug 8 08:43 alert_ mzh.log [oracle @ localhost trace] $vim alert_mzh.log
A backup of contolfile can be found in alter_mzh.log. The latest one is trc,sid_ora_nnnn.trc. There is a line in alter_mzh.log that tells you which is to control backup files.
Backup controlfile written to trace file / u01/app/diag/rdbms/orcl/mzh/trace/mzh_ora_4871.trc
2.5 make a copy
[oracle@localhost trace] $cp mzh_ora_4871.trc mzh.sql
Edit mzh.sql, that is, a copy of mzh_ora_4871.trc.
1) find STARTUP NOMOUNT statement, delete all lines above this line 2) find all lines starting with--, delete these lines 3) find all orcl changed to mzh, all ORCL changed to mzh4) find CREATE CONTROLFILE REUSE DATABASE... Statement, change the REUSE to SET5) and find the RECOVER DATABASE USING BACKUP CONTROLFILE statement Comment it out with a double horizontal line (- -) and the result is as follows: [oracle@mazh dbs] $cat / u01/app/diag/rdbms/mzh/mzh/trace/mzh.sql STARTUP NOMOUNTCREATE CONTROLFILE SET DATABASE "MZH" RESETLOGS NOARCHIVELOG MAXLOGFILES 16 MAXLOGMEMBERS 3 MAXDATAFILES 100 MAXINSTANCES 8 MAXLOGHISTORY 292LOGFILE GROUP 1'/ u01 GROUP 01.log' SIZE 50m BLOCKSIZE 512, GROUP 2'/ u01 SIZE GROUP 3'/ u01ActionoradataPlacement GROUP 3'/ u01ActionoradataPlacement Mzhredo03.log' SIZE 50m BLOCKSIZE 512DATAFILE'/ u01LexexoradataUniplicateSysaux01.dbfbrands,'/ u01UniplicaloradataUniplicationsysaux01.dbfills,'/ u01andappadataplains mzhdotbs01.dbfills,'/ u01aporadataandmzhandusers01.dbfnames,'/ u01apaporadataaloradataandusers01.dbfbrands -- RECOVER DATABASE USING BACKUP CONTROLFILEALTER DATABASE OPEN RESETLOGS;ALTER TABLESPACE TEMP ADD TEMPFILE'/ u01 SIZE RECOVER DATABASE USING BACKUP CONTROLFILEALTER DATABASE OPEN RESETLOGS;ALTER TABLESPACE TEMP ADD TEMPFILE'/ u01 RECOVER DATABASE USING BACKUP CONTROLFILEALTER DATABASE OPEN RESETLOGS;ALTER TABLESPACE TEMP ADD TEMPFILE'/ u01 RECOVER DATABASE USING BACKUP CONTROLFILEALTER DATABASE OPEN RESETLOGS;ALTER TABLESPACE TEMP ADD TEMPFILE'/ u01 RECOVER DATABASE USING BACKUP CONTROLFILEALTER DATABASE OPEN RESETLOGS;ALTER TABLESPACE TEMP ADD TEMPFILE'/ u01 SIZE
2.7 generate profile
[oracle@localhost trace] $sqlplus "/ as sysdba"
Connected to an idle instance. SQL > create pfile='?/dbs/initmzh.ora' from spfile; File created. SQL > exit Disconnected 2.8directory change, which is different from oracle 10g, so be careful.
[sql] view plaincopyprint? [oracle@localhost ~] $cd / u01/app/oracle/ [oracle@localhost oracle] $ls admin cfgtoollogs checkpoints diag flash_recovery_area oradata product [oracle@localhost oracle] $cd flash_recovery_area/ [oracle@localhost flash_recovery_area] $ls orcl ORCL [oracle@localhost flash_recovery_area] $mv orcl/ mzh/ [oracle@localhost flash_recovery_area] $mv ORCL/ mzh/ [oracle@localhost flash_recovery_area] $cd. [oracle@localhost oracle] $ls admin cfgtoollogs checkpoints diag flash_recovery_area oradata product [oracle@localhost oracle] $cd oradata/ [oracle@localhost oradata] $ls orcl [oracle@localhost oradata] $mv orcl/ mzh/ [oracle@localhost oradata] $ls mzh [oracle@localhost oradata] $cd. [oracle@localhost oracle] $ls admin cfgtoollogs checkpoints diag flash_recovery_area oradata product [oracle@localhost oracle] $cd diag/ [oracle@localhost diag] $ls rdbms tnslsnr [oracle@localhost diag] $cd rdbms/ [oracle@localhost rdbms] $ls orcl [oracle@localhost rdbms] $mv orcl/ mzh/ [oracle@localhost rdbms] $ls mzh [oracle@localhost rdbms] $cd mzh [oracle@localhost mzh] $ls i_1.mif mzh [oracle@localhost mzh] $cd. [oracle@localhost rdbms] $cd.. [oracle@localhost diag] $ls rdbms tnslsnr [oracle@localhost diag] $cd.. [oracle@localhost oracle] $cd admin/ [oracle@localhost admin] $ls orcl [oracle@localhost admin] $cd orcl/ [oracle@localhost orcl] $ls adump dpdump pfile [oracle@localhost orcl] $cd. [oracle@localhost admin] $mv orcl/ mzh/ [oracle@localhost admin] $ls mzh [oracle@localhost admin] $sqlplus / as sysdba Connected to an idle instance. SQL >
2.9 deleted control files.
[oracle@localhost oradata] $cd mzh/ [oracle@localhost mzh] $ls control01.ctl redo01.log redo03.log system01.dbf undotbs01.dbf example01.dbf redo02.log sysaux01.dbf temp01.dbf users01.dbf [oracle@localhost mzh] $mv control01.ctl control01.ctl.aaa [oracle@localhost mzh] $ls control01.ctl.aaa redo01.log redo03.log system01.dbf undotbs01.dbf example01.dbf redo02.log sysaux01.dbf temp01.dbf users01.dbf [oracle@localhost mzh] $cd. [oracle@localhost oradata] $ls mzh [oracle@localhost oradata] $cd.. [oracle@localhost oracle] $ls admin cfgtoollogs checkpoints diag flash_recovery_area oradata product [oracle@localhost oracle] $cd flash_recovery_area/ [oracle@localhost flash_recovery_area] $ls mzh mzh [oracle@localhost flash_recovery_area] $cd mzh/ [oracle@localhost mzh] $ls control02.ctl [oracle@localhost mzh] $mv control02.ctl control02.ctl.aaa 2.10 sign in to oracle to generate the spfile file [sql] view plaincopyprint? [oracle@localhost mzh] $sqlplus / as sysdba Connected to an idle instance. SQL > create spfile from pfile='?/dbs/initmzh.ora'; File created. 2.11 call the modified mzh.sql in the previous step to generate link control files, etc.
SQL > @ / u01/app/diag/rdbms/mzh/mzh/trace/mzh.sql ORACLE instance started. Total System Global Area 539848704 bytes Fixed Size 1337748 bytes Variable Size 327157356 bytes Database Buffers 205520896 bytes Redo Buffers 5832704 bytes Control file created. Database altered. Tablespace altered.
2.12 View the result SQL > select open_mode from v$database OPEN_MODE-READ WRITE SQL > show parameter name NAME TYPE VALUE-db_file_name_convert string db _ name string mzh db_unique_name string mzh global_names boolean FALSE instance_name string mzh lock_name_space string log_file_name_convert string service_names string mzh.localdomain SQL > select name from v$database NAME-mzh SQL >
There is an episode in SQL > @ / u01/app/diag/rdbms/mzh/mzh/trace/mzh.sql Times that went wrong as follows:
[oracle@mazh trace] $sqlplus "/ as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 9 09:03:56 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
ERROR:
ORA-09925: Unable to create audit trail file
Linux Error: 2: No such file or directory
Additional information: 9925
ORA-01075: you are currently logged on
Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied
Enter user-name:
ERROR:
ORA-01017: invalid username/password; logon denied
SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
[oracle@mazh trace] $ps-ef | grep smo
Root 470 70 07:10? 00:00:00 [kpsmoused]
Oracle 5236 1 0 09:01? 00:00:00 ora_smon_mzh
Oracle 5263 5047 0 09:04 pts/2 00:00:00 grep smo
[oracle@mazh trace] $kill-9 5236
[oracle@mazh trace] $ps-ef | grep smo
Root 470 70 07:10? 00:00:00 [kpsmoused]
Oracle 5265 5047 0 09:04 pts/2 00:00:00 grep smo
[oracle@mazh trace] $sqlplus "/ as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Fri Aug 9 09:04:36 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.SQL > @ mzh2.sql
ORA-09925: Unable to create audit trail file
Linux Error: 2: No such file or directory
Additional information: 9925
CREATE CONTROLFILE SET DATABASE "MZH" RESETLOGS NOARCHIVELOG
*
ERROR at line 1:
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0
ALTER DATABASE OPEN RESETLOGS
*
ERROR at line 1:
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0
ALTER TABLESPACE TEMP ADD TEMPFILE'/ u01qapqapram oradatamax mzhtemp01.dbf'
*
ERROR at line 1:
ORA-01012: not logged on
Process ID: 0
Session ID: 0 Serial number: 0
I found all kinds of methods on the Internet, but it turned out to be
/ u01/app/oracle/dbs/initmzh.ora parameters unexpectedly tampered with the following reasons are not very clear, please give me some advice.
[oracle@mazh trace] $vi / u01/app/oracle/dbs/initmzh.ora
Orcl.__db_cache_size=83886080
Orcl.__java_pool_size=4194304
Orcl.__large_pool_size=4194304
Orcl.__oracle_base='/u01/app'#ORACLE_BASE set from environment
Orcl.__pga_aggregate_target=79691776
Orcl.__sga_target=239075328
Orcl.__shared_io_pool_size=0
Orcl.__shared_pool_size=138412032
Orcl.__streams_pool_size=4194304
Mzh.__db_cache_size=83886080
Mzh.__java_pool_size=4194304
Mzh.__large_pool_size=4194304
Mzh.__oracle_base='/u01/app'#ORACLE_BASE set from environment
Mzh.__pga_aggregate_target=79691776
Mzh.__sga_target=239075328
Mzh.__shared_io_pool_size=0
Mzh.__shared_pool_size=109051904
Mzh.__streams_pool_size=0
* .audit_file_dest='/u01/app/admin/mzh/adump'
* .audit_trail='db'
* .compatible='11.2.0.0.0'
* .control_files='/u01/app/oradata/mzh/control01.ctl','/u01/app/flash_recovery_area/mzh/control02.ctl'
* .db_block_size=8192
* .db_domain=''
* .db_name='mzh'
* .db_recovery_file_dest='/u01/app/flash_recovery_area'
* .db_recovery_file_dest_size=4039114752
* .diagnostic_dest='/u01/app'
* .dispatchers=' (PROTOCOL=TCP) (SERVICE=mzhXDB)'
* .open_cursors=300
* .pga_aggregate_target=78643200
* .processes=150
* .remote_login_passwordfile='EXCLUSIVE'
* .sga_target=235929600
* .timed_statistics=TRUE
* .undo_tablespace='UNDOTBS1'
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.