Oracle Study之-Oracle 11g OCM考试(2)

Oracle Study之-Oracle 11g OCM考试(2)


11g OCM考试 纲:Server Configuration

  1. 1  Create the database

  2. 2  Determine and set sizing parameters for database structures

  3. 3  Create and manage temporary, permanent, and undo tablespaces

  4. 4  Stripe data files across multiple physical devices and locations


    按照考试要求,配置表空间及控制文件、redo log的多元化


    一、配置表空间


    [oracle@rh64 ~]$ export ORACLE_SID=test1
    [oracle@rh64 ~]$ sqlplus '/as sysdba'
    SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 12 17:24:43 2016
    Copyright (c) 1982, 2011, Oracle.  All rights reserved.
    Connected to an idle instance.
    17:24:43 SYS@ test1>startup
    ORACLE instance started.
    Total System Global Area  313159680 bytes
    Fixed Size                  2227944 bytes
    Variable Size             218104088 bytes
    Database Buffers           88080384 bytes
    Redo Buffers                4747264 bytes
    Database mounted.
    Database opened.

    1)配置Undo表空间

    17:25:12 SYS@ test1>show parameter undo

    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    undo_management                      string      AUTO
    undo_retention                       integer     900
    undo_tablespace                      string      UNDOTBS1

    设置undo_retention参数,可以按照业务中事务最长的查询时间来设置:

    17:25:47 SYS@ test1>alter system set undo_retention=3600;     
    System altered.

    17:26:14 SYS@ test1>show parameter undo;
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    undo_management                      string      AUTO
    undo_retention                       integer     3600
    undo_tablespace                      string      UNDOTBS1


    创建Undo tablespace:

    23:49:48 SYS@ test1>create undo tablespace undotbs2
    23:49:55   2  datafile '/u01/app/oracle/oradata/test1/undotbs02.dbf' size 100m
    23:50:01   3  autoextend on maxsize 2g
    23:50:06   4  extent management local;

    Tablespace created.

    23:50:37 SYS@ test1>show parameter undo

    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    undo_management                      string      AUTO
    undo_retention                       integer     900
    undo_tablespace                      string      UNDOTBS1


    切换undo tablespace
    23:50:43 SYS@ test1>alter system set undo_tablespace='undotbs2';
    System altered.

    23:50:57 SYS@ test1>show parameter undo
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    undo_management                      string      AUTO
    undo_retention                       integer     900
    undo_tablespace                      string      undotbs2

    查看表空间信息

    17:28:03 SYS@ test1> select tablespace_name,file_id,file_name,bytes/1024/1024 "Total_Size(M)" from dba_data_files
    TABLESPACE_NAME                   FILE_ID FILE_NAME                                          Total_Size(M)
    ------------------------------ ---------- -------------------------------------------------- -------------
    SYSTEM                                  1 /u01/app/oracle/oradata/test1/system01.dbf                   325
    SYSAUX                                  2 /u01/app/oracle/oradata/test1/sysaux01.dbf                   325
    UNDOTBS1                                3 /u01/app/oracle/oradata/test1/undotbs01.dbf                  200

    UNDOTBS2                                3 /u01/app/oracle/oradata/test1/undotbs02.dbf                  100
    USERS                                   4 /u01/app/oracle/oradata/test1/users01.dbf                    100

    创建永久表空间
    17:30:14 SYS@ test1>create tablespace test1   
    17:30:26   2  datafile '/u01/app/oracle/oradata/test1/test01.dbf' size 10m
    17:30:46   3  autoextend on maxsize 2g
    17:30:57   4  extent management local uniform size 128k;

    Tablespace created.

    17:31:23 SYS@ test1>select tablespace_name,file_id,file_name,bytes/1024/1024 "Total_Size(M)" from dba_data_files
    17:31:34   2     where tablespace_name='TEST1';

    TABLESPACE_NAME                   FILE_ID FILE_NAME                                          Total_Size(M)
    ------------------------------ ---------- -------------------------------------------------- -------------
    TEST1                                   5 /u01/app/oracle/oradata/test1/test01.dbf                      10
    Elapsed: 00:00:00.00

    17:33:55 SYS@ test1>create tablespace indx
    17:34:04   2  datafile '/u01/app/oracle/oradata/test1/indx01.dbf' size 10m
    17:34:22   3  autoextend on maxsize 2g
    17:34:37   4  extent management local autoallocate 
    17:35:14   5  segment space management manual;

    Tablespace created.

    17:36:15 SYS@ test1>select tablespace_name,file_id,file_name,bytes/1024/1024 "Total_Size(M)" from dba_data_files
    17:36:31   2  where tablespace_name='INDX';

    TABLESPACE_NAME                   FILE_ID FILE_NAME                                          Total_Size(M)
    ------------------------------ ---------- -------------------------------------------------- -------------
    INDX                                    6 /u01/app/oracle/oradata/test1/indx01.dbf                      10
    Elapsed: 00:00:00.01

    创建临时表空间及表空间组:
    17:37:27 SYS@ test1>select TABLESPACE_NAME ,file_name,bytes/1024/1024 from dba_temp_files;

    TABLESPACE_NAME                FILE_NAME                                          BYTES/1024/1024
    ------------------------------ -------------------------------------------------- ---------------
    TEMPTS1                        /u01/app/oracle/oradata/test1/temp01.dbf                        20

    17:38:05 SYS@ test1>create temporary tablespace temp01 
    17:38:23   2  tempfile '/u01/app/oracle/oradata/test1/temp_01.dbf' size 10m
    17:39:01   3  autoextend off tablespace group tmpgp1;

    Tablespace created.

    17:40:14 SYS@ test1>create temporary tablespace temp02
    17:40:20   2  tempfile '/u01/app/oracle/oradata/test1/temp_02.dbf' size 10m
    17:40:36   3  autoextend off;

    Tablespace created.

    17:41:08 SYS@ test1>alter tablespace temp02 tablespace group tmpgp1;
    Tablespace altered.

    17:41:25 SYS@ test1>alter tablespace tempts1 tablespace group tmpgp1;
    Tablespace altered.


    17:44:53 SYS@ test1>select * from dba_tablespace_groups;
    GROUP_NAME                     TABLESPACE_NAME
    ------------------------------ ------------------------------
    TMPGP1                         TEMPTS1
    TMPGP1                         TEMP01
    TMPGP1                         TEMP02

    将临时表空间组设为数据库默认临时表空间:
    17:45:02 SYS@ test1>alter database default temporary tablespace tmpgp1;

    Database altered.

    创建用户测试:
    17:46:59 SYS@ test1>create user tom
    17:47:03   2  identified by tom
    17:47:08   3  default tablespace test1       
    17:47:39   4  quota unlimited on test1
    17:48:03   5  temporary tablespace tmpgp1;

    User created.

    17:48:32 SYS@ test1>grant connect,resource to tom;
    Grant succeeded.

    17:48:42 SYS@ test1>conn tom/tom
    Connected.
    17:48:46 TOM@ test1>


    二)控制文件、redo log file多元化

    1)控制文件多元化
    23:16:35 SYS@ test1>show parameter control
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    control_file_record_keep_time        integer     7
    control_files                        string      /u01/app/oracle/oradata/test1/control01.ctl


    23:16:56 SYS@ test1>col name for a50

    23:17:03 SYS@ test1> select name from v$controlfile
    NAME
    --------------------------------------------------
    /u01/app/oracle/oradata/test1/control01.ctl

    创建控制文件存储目录:(建议将控制文件存储到不同的存储介质上)
    [root@rh64 dsk1]# mkdir -p /dsk1/test1/oradata
    [root@rh64 dsk1]# chown -R oracle:dba /dsk1
    [root@rh64 dsk1]# ls -ld /dsk1/test1/oradata/
    drwxr-xr-x 2 oracle dba 4096 Apr 12 23:20 /dsk1/test1/oradata/

    生成spfile文件:

    23:17:03 SYS@ test1>show parameter spfile
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    spfile                               string
    23:21:36 SYS@ test1>create spfile from pfile;
    File created.

    重新启动数据库,Instance优先使用spfile:
    23:21:43 SYS@ test1>startup force;
    ORACLE instance started.
    Total System Global Area  313159680 bytes
    Fixed Size                  2227944 bytes
    Variable Size             218104088 bytes
    Database Buffers           88080384 bytes
    Redo Buffers                4747264 bytes
    Database mounted.
    Database opened.
    23:22:49 SYS@ test1>show parameter spfile
    NAME                                 TYPE        VALUE
    ------------------------------------ ----------- ------------------------------
    spfile                               string      /u01/app/oracle/product/11.2.0/db_1/dbs/spfiletest1.ora


    23:23:17 SYS@ test1>alter system set control_files ='/u01/app/oracle/oradata/test1/control01.ctl','/dsk1/test1/oradata/control02.ctl' scope=spfile;
    System altered.

    关库后,拷贝控制文件的副本:
    23:24:00 SYS@ test1>shutdown immediate;
    Database closed.
    Database dismounted.
    ORACLE instance shut down.
    23:24:27 SYS@ test1>!cp /u01/app/oracle/oradata/test1/control01.ctl /dsk1/test1/oradata/control02.ctl
    23:24:46 SYS@ test1>startup mount;
    ORACLE instance started.
    Total System Global Area  313159680 bytes
    Fixed Size                  2227944 bytes
    Variable Size             226492696 bytes
    Database Buffers           79691776 bytes
    Redo Buffers                4747264 bytes
    Database mounted.
    23:25:42 SYS@ test1>select name from v$controlfile;
    NAME
    --------------------------------------------------
    /u01/app/oracle/oradata/test1/control01.ctl
    /dsk1/test1/oradata/control02.ctl

    2)增加redo日志组成员(不同成员存储到不同的介质):
    23:25:52 SYS@ test1>col member for a50
    23:26:32 SYS@ test1>select group#,member from v$logfile;
        GROUP# MEMBER
    ---------- --------------------------------------------------
             1 /u01/app/oracle/oradata/test1/redo01a.log
             2 /u01/app/oracle/oradata/test1/redo02a.log

    23:26:39 SYS@ test1>select status from v$instance;

    STATUS
    ------------
    MOUNTED

    添加日志组成员:

    23:30:40 SYS@ test1>alter database add logfile  member

                     '/dsk1/test1/oradata/redo01b.log'   to group 1,

                    '/dsk1/test1/oradata/redo02b.log' to group 2;


    23:30:40 SYS@ test1>select group#,member from v$logfile order by 1;

        GROUP# MEMBER
    ---------- --------------------------------------------------
             1 /dsk1/test1/oradata/redo01b.log
             1 /u01/app/oracle/oradata/test1/redo01a.log
             2 /dsk1/test1/oradata/redo02b.log
             2 /u01/app/oracle/oradata/test1/redo02a.log


    -----------  OCM考试,后续陆续推出。。。








  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
OCM考试全面解析及经验分享 OCM考试全称为Oracle Certified Master(Oracle认证大师),是在OCA(Oracle认证专员Oracle Certified Associate)、OCP(Oracle认证专家Oracle Certified Professional)之后更高一级的Oracle技术认证,也是Oracle技术认证最 OCM考试全称为Oracle Certified Master(Oracle认证大师),是在OCA(Oracle认证专员Oracle Certified Associate)、OCP(Oracle认证专家Oracle Certified Professional)之后更高一级的Oracle技术认证,也是Oracle技术认证最高的一个级别。 考试是两天的时间,全部为实际操作的考试,第一天是创建数据库和安装Grid Control,第二天是创建RAC以及部署Data Guard,其中穿插着几乎所有Oracle数据库管理需要用到的常用知识。 其实,技术上来说OCM考试并不很难,考试涉及的内容也是很喜闻乐见的技术架构。但是问题就在于时间,一个数据库管理员用dbca这样的图形化界面在一个小时里面创建完一个数据库这基本上没有难度,但是要求你不能使用图形界面只能用命令行方式呢?你能记得所有create database的语法吗?你能记得所有storage参数的语法吗?你能记得设定ASSM属性那个四个单词的前后顺序吗? 也许有人会说,我不需要记得啊,我有Oracle Online Documentation可以查询哦,是的,没错,OCM考试允许你查询Oracle的联机帮助文档(仅仅限于联机文档而不允许使用internet去做搜索),但是你能在几分钟内定位到你想要找的内容呢?又一共有多少个知识点你需要去查文档呢?而两个小时的考试时间又允许你去查多少次联机文档呢?我个人认为我对联机文档已经颇为熟悉了,但是今天上午的经验让我必须承认,如果我不继续加以练习,我绝对无法在规定时间内创建出完全符合考试要求的数据库。而如果第一天上午考试结束的时候你没有创建出需要的数据库,那么这次OCM考试你就失败了,因为后面考试的内容是要使用到这个数据库的。 最后,只要是考试就会有压力,当时间一点一滴流逝的时候,你能确保自己在最后的半小时里面还能像刚开始考试时候那样冷静吗?本来一次就能输入正确的SQL语句,会不会就要多输错几个单词,多按几次Delete键,多看到几次ORA报错信息才能完成输入呢? 好吧,这一系列文章的目的并不是给大家施加压力,而是准备告诉大家如何应对OCM考试,这几乎已经无关乎技术,而更多的是技巧了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值