关库顺序 :先关闭数据库 然后关闭节点资源

[root@rac1 ~]# srvctl stop   database  -d 数据库名
[root@rac1 ~]# srvctl stop   instance  -d  数据库名   -i  实例1
[root@rac1 ~]# srvctl stop   instance  -d  数据库名  -i   实例2
[root@rac1 ~]# srvctl stop   nodeapps  -n  节点1  
[root@rac1 ~]# srvctl start  nodeapps  -n   节点2

启库顺序相反

[root@rac1 ~]# srvctl start  nodeapps  -n  节点1
[root@rac1 ~]# srvctl start  nodeapps  -n  节点2
[root@rac1 ~]# srvctl start  instance  -d   数据库名  -i 实例1
[root@rac1 ~]# srvctl start  instance  -d   数据库名  -i 实例2
[root@rac1 ~]# srvctl start  database  -d  数据库名

[root@rac1 ~]# srvctl stop  database  -d prod                root用户关库命令
[root@rac1 ~]# srvctl start database  -d prod                root用户启库命令
[root@rac1 ~]# srvctl stop  instance  -d prod  -i prod1      关闭实例
[root@rac1 ~]# crsctl stop  crs                              关闭crs资源
[root@rac1 ~]# crsctl check crs                              查看crs资源的状态
[root@rac1 ~]# crs_stat -t

[root@rac1 ~]# srvctl stop nodeapps -n rac1                  关闭节点应用  rac1

[root@rac1 ~]# more  /etc/inittab

x:5:respawn:/etc/X11/prefdm -nodaemon
h1:35:respawn:/etc/init.d/init.evmd run >/dev/null 2>&1 </dev/null
h2:35:respawn:/etc/init.d/init.cssd fatal >/dev/null 2>&1 </dev/null   查看 css   fatal  致命的如果启动失败  导致节点重启
h3:35:respawn:/etc/init.d/init.crsd run >/dev/null 2>&1 </dev/null

[root@rac1 ~]# tail -f /var/log/messages 操作系统日志

[root@rac1 ~]# cd /u01/crs_1/log/rac1/

[root@rac1 rac1]# ls
admin  alertrac1.log  client  crsd  cssd  evmd  racg        crs系统日志

[root@rac1 rac1]# tail -f alertrac1.log

2013-01-30 01:33:32.929
[cssd(7013)]CRS-1605:CSSD voting file is online: /dev/raw/raw8. Details in /u01/crs_1/log/rac1/cssd/ocssd.log.
2013-01-30 01:33:36.410
[cssd(7013)]CRS-1601:CSSD Reconfiguration complete. Active nodes are rac1 rac2 .
2013-01-30 01:33:36.792
[crsd(6058)]CRS-1012:The OCR service started on node rac1.
2013-01-30 01:33:36.828
[evmd(6898)]CRS-1401:EVMD started on node rac1.
2013-01-30 01:33:38.762
[crsd(6058)]CRS-1201:CRSD started on node rac1.

SQL> select instance_number,instance_name from gv$instance;

INSTANCE_NUMBER INSTANCE_NAME
--------------- ----------------
              1 prod1
              2 prod2

查看两个节点 两个实例

SQL> show parameter name;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string
db_name                              string      prod
db_unique_name                       string      prod
global_names                         boolean     FALSE
instance_name                        string      prod1
lock_name_space                      string
log_file_name_convert                string
service_names                        string      prod

SQL> show parameter name;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string
db_name                              string      prod
db_unique_name                       string      prod
global_names                         boolean     FALSE
instance_name                        string      prod2
lock_name_space                      string
log_file_name_convert                string
service_names                        string      prod

SQL> select  name from v$datafile;

NAME
--------------------------------------------------------------------------------
+DG1/prod/datafile/system.256.805961653
+DG1/prod/datafile/undotbs1.258.805961657
+DG1/prod/datafile/sysaux.257.805961655
+DG1/prod/datafile/users.259.805961657
+DG1/prod/datafile/example.264.805961789
+DG1/prod/datafile/undotbs2.265.805961897

SQL> select name from v$tempfile;      临时文件放于其他磁盘了

NAME
--------------------------------------------------------------------------------
+DG1/prod/tempfile/temp.263.805961781

SQL> select name from v$controlfile;     控制文件自动多元化  人性化吧

NAME
--------------------------------------------------------------------------------
+DG1/prod/controlfile/current.260.805961753
+RECOVERY/prod/controlfile/current.256.805961755

SQL> select *  from v$log;   查看 thread 线程号      两个节点 故线程号  2个

GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1          2   52428800          2 NO  INACTIVE   474739 29-JAN-13
         2          1          3   52428800          2 NO  CURRENT   528602 30-JAN-13
         3          2          1   52428800          2 NO  CURRENT   478694 29-JAN-13
         4          2          0   52428800          2 YES UNUSED0

SQL> alter database add logfile thread 1 group 5 '+dg1' size 50m;   添加日志组  其实后面的group 5  组号 不用写 oracle自行设定

Database altered.

指明文件存放的路径   这就是 OMF 的优势    管理更为方便  文件名 oracle自行管理  我们只需指定路径就好了

SQL> alter database add logfile thread 2 size 50m;  给线程2 添加日志组 默认添加两个成员 磁盘组dg1  磁盘组recovery

Database altered.

SQL> alter database add logfile member '+RECOVERY' to group 5;        指定存储位置 添加日志成员

Database altered.

SQL> show parameter create;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
create_bitmap_area_size              integer     8388608
create_stored_outlines               string
db_create_file_dest                  string      +DG1          这就是oracle自行设定的路径
db_create_online_log_dest_1          string
db_create_online_log_dest_2          string
db_create_online_log_dest_3          string
db_create_online_log_dest_4          string
db_create_online_log_dest_5          string

SQL> create tablespace tbs1;       创建表空间   路径不用指定     OMF的优势

Tablespace created.

SQL> create tablespace tbs2 datafile '+RECOVERY' size 50m;     创建表空间  指定磁盘组    指定 大小   如果不指定 默认100m

Tablespace created.

SQL> select name,bytes/1024/1024 from v$datafile;

NAME                                               BYTES/1024/1024
-------------------------------------------------- ---------------
+DG1/prod/datafile/system.256.808026577                        480
+DG1/prod/datafile/undotbs1.258.808026579                       35
+DG1/prod/datafile/sysaux.257.808026579                        250
+DG1/prod/datafile/users.259.808026581                           5
+DG1/prod/datafile/example.264.808026717                       100
+DG1/prod/datafile/undotbs2.265.808026831                       25
+DG1/prod/datafile/tbs1.270.808033599                          100
+RECOVERY/prod/datafile/tbs2.263.808033653                      50

tbs1  指定大小    100m   
tbs2  不指定大小  50m   对了吧

[oracle@rac1 ~]$ more /u01/app/oracle/product/10.2.0/db_1/dbs/initprod1.ora  rac下的pfile里面只有一句话  指定spfile

SPFILE='+DG1/prod/spfileprod.ora'

SQL> create pfile='/home/oracle/initprod.ora' from spfile;   备份spfile 注意指定路径 不然放于asm磁盘组了

File created.

[oracle@rac1 ~]$ more /home/oracle/initprod.ora

prod1.__db_cache_size=176160768
prod2.__db_cache_size=167772160
prod1.__java_pool_size=4194304
prod2.__java_pool_size=4194304
prod1.__large_pool_size=4194304
prod2.__large_pool_size=4194304
prod1.__shared_pool_size=96468992
prod2.__shared_pool_size=104857600
prod1.__streams_pool_size=0
prod2.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/prod/adump'
*.background_dump_dest='/u01/app/oracle/admin/prod/bdump'
*.cluster_database_instances=2
*.cluster_database=true
*.compatible='10.2.0.1.0'
*.control_files='+DG1/prod/controlfile/current.260.805961753','+RECOVERY/prod/co
ntrolfile/current.256.805961755'
*.core_dump_dest='/u01/app/oracle/admin/prod/cdump'
*.db_block_size=8192
*.db_create_file_dest='+DG1'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='prod'
*.db_recovery_file_dest='+RECOVERY'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=prodXDB)'
prod2.instance_number=2
prod1.instance_number=1
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=94371840
*.processes=150
*.remote_listener='LISTENERS_PROD'
*.remote_login_passwordfile='exclusive'
*.sga_target=285212672
prod2.thread=2
prod1.thread=1
*.undo_management='AUTO'
prod1.undo_tablespace='UNDOTBS1'
prod2.undo_tablespace='UNDOTBS2'
*.user_dump_dest='/u01/app/oracle/admin/prod/udump'

配置客户端

服务器端  tnsnames 文件  注意 host 都是对应 vip地址(漂移地址)

PROD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = prod)
    )
  )

PROD2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = prod)
      (INSTANCE_NAME = prod2)
    )
  )

PROD1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = prod)
      (INSTANCE_NAME = prod1)
    )
  )

修改客户端 tnsnames

配置归档

[oracle@rac1 ~]# mkdir  /u01/arch
[oracle@rac2 ~]# mkdir  /u01/arch

[oracle@rac1 ~]# vi  /etc/exports   
/u01/arch  192.168.8.30/24(sync,rw)

[oracle@rac1 ~]# service nfs start

Starting NFS services:  [  OK  ]
Starting NFS quotas: [  OK  ]
Starting NFS daemon: [  OK  ]
Starting NFS mountd: [  OK  ]
               
[oracle@rac1 ~]# chkcofig nfs on

[oracle@rac2 ~]# mount -t nfs -o rw,bg,hard,soft,nointr,rsize=32768,wsize=32768,timeo=600,actimeo=0   rac1:/u01/arch  /u01/arch
[oracle@rac1 ~]# vi /etc/fstab

rac1:/u01/arch  /u01/arch     rw,bg,hard,soft,nointr,rsize=32768,wsize=32768,timeo=600,actimeo=0    参数

两个节点关库 任一节点启库到mount状态

SQL> alter database archivelog ;

Database altered.

SQL> alter system set log_archive_dest='location=/u01/arch' scope=spfile;

System altered.

SQL> alter system archive log current;

System altered.

asm  磁盘组

SQL> desc  v$asm_diskgroup;
 Name                                                                                                              Null?    Type
 ----------------------------------------------------------------------------------------------------------------- -------- ----------------------------------------------------------------------------
 GROUP_NUMBER                                                                                                               NUMBER
 NAME                                                                                                                       VARCHAR2(30)
 SECTOR_SIZE                                                                                                                NUMBER
 BLOCK_SIZE                                                                                                                 NUMBER
 ALLOCATION_UNIT_SIZE                                                                                                       NUMBER
 STATE                                                                                                                      VARCHAR2(11)
 TYPE                                                                                                                       VARCHAR2(6)
 TOTAL_MB                                                                                                                   NUMBER
 FREE_MB                                                                                                                    NUMBER
 REQUIRED_MIRROR_FREE_MB                                                                                                    NUMBER
 USABLE_FILE_MB                                                                                                             NUMBER
 OFFLINE_DISKS                                                                                                              NUMBER
 UNBALANCED                                                                                                                 VARCHAR2(1)
 COMPATIBILITY                                                                                                              VARCHAR2(60)
 DATABASE_COMPATIBILITY                                                                                                     VARCHAR2(60)

SQL> select  GROUP_NUMBER , NAME  ,BLOCK_SIZE, STATE ,TOTAL_MB, FREE_MB  ,USABLE_FILE_MB  ,OFFLINE_DISKS  from v$asm_diskgroup;

GROUP_NUMBER NAME                           BLOCK_SIZE STATE         TOTAL_MB    FREE_MB USABLE_FILE_MB OFFLINE_DISKS
------------ ------------------------------ ---------- ----------- ---------- ---------- -------------- -------------
           1 DG1                                  4096 CONNECTED         8192       5226           2613             0
           2 RECOVERY                             4096 CONNECTED         8192       6840           3420             0

[oracle@rac1 ~]$ export ORACLE_SID=+ASM1
[oracle@rac1 ~]$ sqlplus / as sysdba

SQL> create  diskgroup dg2 external redundancy  disk '/dev/raw/raw5';

Diskgroup created.

alter diskgroup  dg2  mount;
alter diskgroup dg2 dismount;
create  diskgroup dg2 normal redundancy  disk '/dev/raw/rawXXXXX';   创建 normal磁盘 报错  至少需要两块

修改asm 的 pfile  把新加的磁盘组 加入开机自动
asm_disgroups='dg1'.'recovery','dg2'

alter  database backup controlfile to '+dg2/prod/controlfile/controlfile01.ctl'  ;
alter  diskgroup add directory '+dg1/prod/controlfile' scope=spfile;

RAC配置(启停库)的更多相关文章

  1. 【RAC】Oracle 10g RAC相关启停命令,维护命令

    Oracle10g RAC关闭及启动步骤   情况1:需要关闭DB(所有实例),OS及Server. a.首先停止Oracle10g环境 $ lsnrctl stop (每个节点上停止监听,也可以用s ...

  2. oracle 11gR2 RAC 停库和启库

    grid设置环境变量后可以在任意目录下执行,如root没设置的话需要带绝对路径export ORACLE_HOME=/u01/app/11.2.0/gridexport PATH=$ORACLE_HO ...

  3. redis安装、配置、启停

    Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and ...

  4. nginx和php-fpm的启停和配置

    一.nginx的启停 (1) 启动nginx /etc/init.d/nginx start (2) 停止nginx /etc/init.d/nginx stop (3) 重启nginx /etc/i ...

  5. oracle 10g/11g RAC 启停归档模式

     oracle 10g rac 启停归档模式    假设Oracle数据库执行在归档模式,当进行数据库维护时,可能须要暂停数据库的归档,在完毕维护后,再又一次启动归档模式. 通过下面步骤能够从归档 ...

  6. 2、Redis如何配置成一个windows服务并且设置一键安装卸载与启停

    每天启动redis虽然只是一个命令行的事情,但是还是比较烦,所以…… 参考文档:Windows Service Documentation.docx 默认前提:Redis已安装并配置完成(不知道如何配 ...

  7. 11g RAC r2 的启停命令概述1

    目标: 熟悉主要进程的启停顺序 了解独占模式 -excl crsctl start crs与crsctl start cluster 区别 1.熟悉主要进程的启停顺序 1.1 启动节点rac1: [r ...

  8. Codis-dashboard的配置和启停

    Codis-dashboard是集群的管理工具 生成配置文件,即将现有的配置文件输出到指定目录位置: ./codis-dashboard --default-config | tee conf/das ...

  9. ASP.NET CORE Linux发布工具(文件对比 只上传差异文件;自动启停WebServer命令;上传完成自动预热WebServer)

    最近这几日在搞一个小网站:教你啊 :(感兴趣的朋友可以来捧场,在这个网站上有任何消费我都可以退还) 由于更新频繁,手动更新特别麻烦,于是开发了这个小工具 用了一段时间,还是挺顺手的,同时.NET Co ...

随机推荐

  1. Vue 动态图片加载路径问题和解决方法

    最近在做一个树形结构的组件,使用了Vue和element UI中el-tree组件.因为树中每个节点都需要显示一个图标图片,并且需要根据后台传入的数据类型动态地显示,所以图片的路径需要动态地加载.下面 ...

  2. 解决Duilib集成CEF浏览器在Win10无法向客户区拖拽文件

    在Duilib中集成CEF浏览器项目实际开发中,遇到一个问题. 一个需求从资源管理器(桌面)拖拽文件到客户端,窗口捕获WM_DROPFILES消息然后进行消息处理,但客户区是集成的CEF浏览器,浏览器 ...

  3. C++11 正则表达式——实例系统(转载)

    一.用正则表达式判断邮箱格式是否正确 1 #include <regex> #include <iostream> #include <string> bool i ...

  4. 关于activity生命周期,启动模式和tag

    Acticity启动模式 1.standard:Activity的默认加载方法,该方法会通过跳转到一个新的activity,同时将该实例压入到栈中(不管该activity是否已经存在在Task栈中,都 ...

  5. 高通平台读写nv总结【转】

    本文转载自:https://blog.csdn.net/suofeng12345/article/details/52713993 一,引言      1. 什么是NV       高通平台的NV,保 ...

  6. 获取String类型汉字乱码,如何进行编码

    本文为博主原创,未经允许不得转载: 在解析properties文件中的汉字时,在java代码中解析得到的是一个乱码字符,形如图下: 导致乱码原因:由于在jdk中,默认为gbk编码方式进行编码盒接收的, ...

  7. YOLO(Darknet官方)训练分类器

    目录 1. 分类数据准备 2. Darknet配置 3. Darknet命令使用 4. cifar-10 使用示例 1. 分类数据准备 需要的文件列表: 1. train.list : 训练的图片的绝 ...

  8. grpc python quickstart

    参考:grpc python quickstart 准备 1.升级pip $ python -m pip install --upgrade pip 2.安装grpc $ python -m pip ...

  9. 使用caffenet微调时的一些总结

    1,比较笨的方法生成图片列表(两类举例)data/myself/train 目录下 find -name cat.\*.jpg |cut -d '/' -f2-3 >train.txtsed - ...

  10. MySql 插入数据返回数据的Id值

    insert into addeditemgroup(addeditemgroupname) value(') ; select @@IDENTITY  as id; 返回最新的Id: