導航:首頁 > 文件目錄 > oracle修改控制文件路徑

oracle修改控制文件路徑

發布時間:2023-07-06 03:19:05

1. oracle中怎麼重建控制文件或是修改控制文件參數

環境:
OS:Red Hat Linux As 5
DB:10.2.0.4

在全部控制文件丟失或損壞,而且沒有備份的情況下,可以使用重建控制文件的辦法打開資料庫.以下模擬所有的控制文件丟失的情況下重建控制文件.

1.備份控制文件(資料庫mount或是open狀態)
SQL> select status from v$instance;
STATUS
------------
OPEN
SQL>alter database backup controlfile to trace as '/u01/ftp/bak_controlfile';

2.刪除控制文件
[oracle@hxl oracl]$ rm control01.ctl
rm: remove regular file `control01.ctl'? y
[oracle@hxl oracl]$ rm control02.ctl
rm: remove regular file `control02.ctl'? y
[oracle@hxl oracl]$ rm control03.ctl
rm: remove regular file `control03.ctl'? y

3.關閉資料庫後嘗試打開資料庫
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 734003200 bytes
Fixed Size 1221564 bytes
Variable Size 218106948 bytes
Database Buffers 511705088 bytes
Redo Buffers 2969600 bytes
ORA-00205: error in identifying control file, check alert log for more info
這個時候數據無法打開,以為我們已經刪除了控制文件.

4.查看備份控制文件的內容
[oracle@hxl ftp]$ more bak_controlfile
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf
--
-- DB_UNIQUE_NAME="oracl"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=2
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=?/dbs/arch
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_10='LOCATION=USE_DB_RECOVERY_FILE_DEST'
-- LOG_ARCHIVE_DEST_10='OPTIONAL REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_10='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_10='REGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_10='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_10='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_10=ENABLE
--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
-- Set #1. NORESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORACL" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/oracl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/oracl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/oracl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/oracl/system01.dbf',
'/u01/app/oracle/oradata/oracl/undotbs01.dbf',
'/u01/app/oracle/oradata/oracl/sysaux01.dbf',
'/u01/app/oracle/oradata/oracl/users01.dbf'
CHARACTER SET WE8ISO8859P1
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- All logs need archiving and a log switch is needed.
ALTER SYSTEM ARCHIVE LOG ALL;
-- Database can now be opened normally.
ALTER DATABASE OPEN;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/oracl/temp01.dbf'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
-- Set #2. RESETLOGS case
--
-- The following commands will create a new control file and use it
-- to open the database.
-- Data used by Recovery Manager will be lost.
-- The contents of online logs will be lost and all backups will
-- be invalidated. Use this only if online logs are damaged.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORACL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/oracl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/oracl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/oracl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/oracl/system01.dbf',
'/u01/app/oracle/oradata/oracl/undotbs01.dbf',
'/u01/app/oracle/oradata/oracl/sysaux01.dbf',
'/u01/app/oracle/oradata/oracl/users01.dbf'
CHARACTER SET WE8ISO8859P1
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area/ORACL/archivelog/2012_06_12/o1_mf_1_1_%u_.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/oracl/temp01.dbf'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
5.從備份控制文件中提取我們需要的部分,這里我們選擇RESETLOGS,將如下內容保存文件為
create_confile.sql

CREATE CONTROLFILE REUSE DATABASE "ORACL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/oracl/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/oracl/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/oracl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/oracl/system01.dbf',
'/u01/app/oracle/oradata/oracl/undotbs01.dbf',
'/u01/app/oracle/oradata/oracl/sysaux01.dbf',
'/u01/app/oracle/oradata/oracl/users01.dbf'
CHARACTER SET WE8ISO8859P1
;

6.執行create_confile.sql
SQL>set sqlblanklines on -- 因為文件中有空行,需要將該選項打開,否則執行的時候報語法錯誤
SQL>@/u01/ftp/create_confile.sql

SQL> alter database open resetlogs;
Database altered.

說明:
重建控制文件後,若備份信息是存儲在控制文件的,該信息會丟失.

2. oracle中修改臨時文件temp01.dbf的位置

在資料庫open狀態下,執行下面語句試試.
ALTER SYSTEM CHECK DATAFILES;

(處理臨時文件的問題,風險會小些,不過在正式庫下操作,注意備份先)

3. 如何更改資料庫實例存放的位置

具體方法如下:假設這里安裝的資料庫名是XLJC。

找到資料庫XLJC下面的文件pfile,在pfile中用文本編輯器打開orit.ora文件。

這里的路徑是C:oracleadminXLJCpfile。

找到行control_files=("c:oracleoradataXLJCcontrol01.ctl", "c:oracleoradataXLJCcontrol02.ctl", "c:oracleoradataXLJCcontrol03.ctl")

將盤符c:變成你所要存放的盤符,比如d:。

然後保存退出。

4. oracle 11G資料庫修改 資料庫實例讀取的數據文件位置

首先,導入導出不一定用命令,你電腦中毒導致你命令不好使,可能是環境變數等有問題出現回,答你安裝oracle 的文件磁碟沒有損壞的情況,資料庫可以正常運行的情況,你可一選擇用快捷方式的方式去將,實例整個導出來

安裝目錄下有一堆導出的快捷方式,不一定必須使用cmd 按命令去導出

按照你描述的處理方式,具體是需要改控制文件還是怎麼樣的,這個就不了解,畢竟沒有處理過你這種情況,抱歉愛莫能助。

閱讀全文

與oracle修改控制文件路徑相關的資料

熱點內容
微信打碼賺錢安卓軟體 瀏覽:608
蘋果官換機買什麼版本 瀏覽:979
visio數據模型怎麼用 瀏覽:179
關於駕駛的app 瀏覽:92
多線程編程有什麼特點 瀏覽:453
iso文件系統 瀏覽:116
蘋果932攔截騷擾電話 瀏覽:765
盲盒開箱app有哪些 瀏覽:422
win10激活腳本之家 瀏覽:191
魔鬼作坊工具包 瀏覽:185
ae源文件下載 瀏覽:520
如何將照片內容轉換成pdf文件 瀏覽:137
浙里辦app如何更換手機號碼 瀏覽:244
電子資料文件有哪些 瀏覽:241
猥瑣貓表情教程 瀏覽:599
android音頻文件格式 瀏覽:458
漫畫臉app哪裡可以下載 瀏覽:959
購買歡樂升級歡樂豆 瀏覽:282
學習智能機器人用什麼編程最好 瀏覽:655
蘋果手機如何管控app 瀏覽:633

友情鏈接