导航:首页 > 编程大全 > 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启停数据库相关的资料

热点内容
联想win10怎么做bat文件 浏览:611
手机编程软件哪个好处 浏览:49
信号与系统视频教程哪个好 浏览:366
51aspx下载的源码要打开那些文件 浏览:221
自家的网络被改了怎么办 浏览:151
手机版ygopro联机工具 浏览:259
为什么斐讯网站登不上 浏览:420
查阅系统中的部门文件 浏览:213
数据库怎么传到另一个电脑 浏览:802
帝国网站b2b 浏览:198
ios6越狱后旧版本软件下载 浏览:694
编程猫软件如何显示猜对次数 浏览:89
javaword分词器 浏览:909
文件名与字符的关系 浏览:607
数据线应该插到笔记本的哪里 浏览:580
拓尔思数据中心有多少台服务器 浏览:330
sourceinsight文件格式编码 浏览:326
多游斗地主网站为什么打不开 浏览:994
找不到文件了如何重装 浏览:18
cad自动缓存文件位置 浏览:729

友情链接