導航:首頁 > 編程大全 > oraclerac啟停資料庫

oraclerac啟停資料庫

發布時間:2023-08-11 20:52:38

A. 啟動oracle資料庫命令

(1)startup(用sys用戶或者其他擁有啟動資料庫許可權的用戶登錄資料庫軟體,然後執行該命令即可,如果存在多個實例,請在啟動前確認SID),資料庫有三個狀態nomount,mount,和open,默認開啟到open,如果開啟到另外兩個狀態,那麼可以通過alter命令改變狀態。
(2)如果是rac中啟停資料庫節點,那麼有專門的命令srvcrl(這個僅僅是命令的操作符,後面有參數的,參數我就不寫了,具體可以查一下,網上很多與偶內容的),另外還有crscrl(啟停crs服務的命令,同樣也是操作符,後面有參數的,這里也不寫了,自己查一下就可以了)
(3)啟動資料庫還有一個命令就是啟動監聽,lsnrctl命令(後面同樣有參數,能啟動停止,也能查詢監聽狀態,這個監聽的基本命令)

B. Oracle 12c RAC,其中一個節點資料庫實例起不來,怎麼辦

兩個節點,第一個節點能正常啟動,但第二個節點報錯。
無論是在集群還是在實例,都無法啟動資料庫實例。
[grid@m2 ~]$ srvctl start instance -d mdb -i mdb2
PRCR-1013 : 無法啟動資源 ora.mdb.db
PRCR-1064 : 無法在節點 m2 上啟動資源 ora.mdb.db
ORA-00203: ??????????
ORA-00202: ????: ''+DATA/mdb/controlfile/current.268.821031437''
CRS-2674: 未能啟動 'ora.mdb.db' (在 'm2' 上)
[grid@m2 ~]$ pwd
/home/grid
[grid@m2 ~]$ ll
總計 4
drwxrwxr-x 3 grid oinstall 4096 07-15 15:35 oradiag_grid
[grid@m2 ~]$ pwd
/home/grid
[grid@m2 ~]$ srvctl status asm -n m1
ASM 正在 m1 上運行
[grid@m2 ~]$ srvctl status asm -n m2
ASM 正在 m2 上運行
ORA-03113: end-of-file on communication channel
使用相同的pfile啟動。
SQL> startup pfile='/opt/app/oracle/proct/11.2.0/dbs/initmdb1.ora';
ORACLE instance started.
Total System Global Area 1607008256 bytes
Fixed Size 1336820 bytes
Variable Size 469764620 bytes
Database Buffers 1124073472 bytes
Redo Buffers 11833344 bytes
ORA-00203: using the wrong control files
ORA-00202: control file: '+DATA/mdb/controlfile/current.268.821031437'
NODE M2:
SQL> show parameter control
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
control_file_record_keep_time integer
7
control_files string
+DATA/mdb/controlfile/current.
268.821031437, +RECOVERY/mdb/c
ontrolfile/current.269.8210314
39
control_management_pack_access string
DIAGNOSTIC+TUNING
SQL>
NODE M1:
SQL> show parameter control
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
control_file_record_keep_time integer
7
control_files string
+DATA/mdb/controlfile/current.
268.821031437, +RECOVERY/mdb/c
ontrolfile/current.269.8210314
39
control_management_pack_access string
DIAGNOSTIC+TUNING
SQL>
懷疑是虛擬機中的磁碟設置問題,修改虛擬機文件
把 scsi0:1.type="disk"
修改為:
scsi0:1.shared="TRUE"
其它兩項不變
scsi0:1.virtualDev = "lsilogic"
scsi0:1.SharedBus="Virtual"
所有共享磁碟修改後為:
scsi0:1.virtualDev = "lsilogic"
scsi0:1.sharedBus = "VIRTUAL"
scsi0:1.shared="TRUE"
disk.locking="FALSE"
========================================================
修改後,再啟動實例,還是無法啟動,報控制文件出錯:
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 1607008256 bytes
Fixed Size 1336820 bytes
Variable Size 520096268 bytes
Database Buffers 1073741824 bytes
Redo Buffers 11833344 bytes
ORA-00214: control file '+RECOVERY/mdb/controlfile/current.269.821031439'
version 1199 inconsistent with file
'+DATA/mdb/controlfile/current.283.821115539' version 522
SQL> show parameter spfile;
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
spfile string
+DATA/mdb/spfilemdb.ora
SQL> select instance_name from v$instance;
INSTANCE_NAME
------------------------------------------------
mdb1
SQL> show parameter spfile;
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
spfile string
+DATA/mdb/spfilemdb.ora
SQL> select instance_name from v$instance;
INSTANCE_NAME
------------------------------------------------
mdb1
SQL> create pfile from spfile;
File created.
SQL> shutdown abort;
ORACLE instance shut down.
SQL> exit
[oracle@m1 dbs]$ vi initmdb1.ora
[oracle@m1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Proction on Thu Jul 18 15:24:51 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup pfile='/opt/app/oracle/proct/11.2.0/dbs/initmdb1.ora';
ORACLE instance started.
Total System Global Area 1607008256 bytes
Fixed Size 1336820 bytes
Variable Size 520096268 bytes
Database Buffers 1073741824 bytes
Redo Buffers 11833344 bytes
Database mounted.
Database opened.
SQL>
[oracle@m1 dbs]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Proction on Thu Jul 18 15:29:09 2013
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup nomount;
Oracle instance started
Total System Global Area 1607008256 bytes
Fixed Size 1336820 bytes
Variable Size 520096268 bytes
Database Buffers 1073741824 bytes
Redo Buffers 11833344 bytes
RMAN> restore controlfile to '+DATA' from '+RECOVERY/mdb/controlfile/current.269.821031439';
Starting restore at 2013-07-18 15:30:28
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=143 instance=mdb1 device type=DISK
channel ORA_DISK_1: copied control file
Finished restore at 2013-07-18 15:30:36
RMAN> restore controlfile to '+DATA' from '+RECOVERY/mdb/controlfile/current.269.821031439';
Starting restore at 2013-07-18 15:38:57
using channel ORA_DISK_1
channel ORA_DISK_1: copied control file
Finished restore at 2013-07-18 15:39:05
RMAN> exit
恢復控制文件的同時,可以在其它窗口看到增加的控制文件名稱:
ASMCMD> ls
Current.256.820944177
Current.268.821031437
current.282.821115029
ASMCMD> ls
Current.256.820944177
Current.268.821031437
current.282.821115029
current.283.821115539
ASMCMD>
後面兩個文件是這次恢復的。
修改pfile,添加進去:
*.control_files='+DATA/mdb/controlfile/current.282.821115029','+DATA/mdb/controlfile/current.283.821115539','+RECOVERY/mdb/controlfile/current.269.821031439'
再次使用pfile啟動資料庫後,建立spfile 文件。
SQL> startup pfile='/opt/app/oracle/proct/11.2.0/dbs/initmdb1.ora';
ORACLE instance started.
Total System Global Area 1607008256 bytes
Fixed Size 1336820 bytes
Variable Size 520096268 bytes
Database Buffers 1073741824 bytes
Redo Buffers 11833344 bytes
Database mounted.
Database opened.
SQL>
create spfile='+DATA/mdb/spfilemdb.ora' from pfile='/opt/app/oracle/proct/11.2.0/dbs/initmdb1.ora';
修改pfile文件指定到新生成的共享磁碟中的spfile
[oracle@m1 dbs]$ cat initmdb1.ora
SPFILE='+DATA/mdb/spfilemdb.ora'
[oracle@m1 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Proction on Thu Jul 18 15:53:56 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 1607008256 bytes
Fixed Size 1336820 bytes
Variable Size 520096268 bytes
Database Buffers 1073741824 bytes
Redo Buffers 11833344 bytes
Database mounted.
Database opened.
SQL>
完成後,再另一個節點啟動資料庫實例:
[oracle@m2 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Proction on Thu Jul 18 15:58:55 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 1607008256 bytes
Fixed Size 1336820 bytes
Variable Size 469764620 bytes
Database Buffers 1124073472 bytes
Redo Buffers 11833344 bytes
Database mounted.
Database opened.
SQL> create table tst_tbs(id number(10),prod_name varchar2(50));
Table created.
SQL> insert into tst_tbs values(1,'test name');
1 row created.
SQL> commit;
Commit complete.
在另一個實例中可以看到剛才插入的數據。
SQL> select id,prod_name from tst_tbs;
ID
----------
PROD_NAME
--------------------------------------------------------------------------------
1
test name
SQL> select instance_name from v$instance;
INSTANCE_NAME
------------------------------------------------
mdb1
SQL>
在RAC中,看到資料庫沒啟動起來,再次使用RAC的命令啟動一下資料庫,完成。
[grid@m1 ~]$ crs_stat -t
Name Type Target State Host

閱讀全文

與oraclerac啟停資料庫相關的資料

熱點內容
nyx在網路上是什麼意思 瀏覽:145
樂播農業app是什麼 瀏覽:530
編程框架如何開發 瀏覽:136
金庸群俠傳3修改代碼 瀏覽:712
檢察院的文件類別有哪些 瀏覽:793
怎麼把九游殘留數據刪除 瀏覽:828
有什麼女生主動聊天的app 瀏覽:436
有哪些可以督促自己的app 瀏覽:244
用USB傳輸視頻文件夾顯示為空 瀏覽:710
恢復文件軟體免費版手機 瀏覽:648
lg怎麼隱藏文件 瀏覽:836
蘋果免費讀書app推薦 瀏覽:497
劉駿微信 瀏覽:113
書旗舊版本80 瀏覽:467
教編程考什麼證 瀏覽:990
下載編程貓後哪裡有客服 瀏覽:13
如何編輯歌曲文件格式 瀏覽:638
cf無限領取cdk工具 瀏覽:350
如何讓手機文件保存到電腦上 瀏覽:459
sa資料庫默認密碼是多少 瀏覽:191

友情鏈接