ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Server Configuration 练习

Server Configuration 练习

原创 Linux操作系统 作者:木呼 时间:2012-08-03 21:26:46 0 删除 编辑

[ 1 ] create the databse
[ 2 ] Determine and set sizing parameters for database structures
[oracle@ocm1 ~]$ cd $ORACLE_HOME/dbs/
[oracle@ocm1 dbs]$ ls
initdw.ora  init.ora
[oracle@ocm1 dbs]$ cat init.ora|grep -v ^#>initorcl.ora
[oracle@ocm1 dbs]$ vi initorcl.ora
db_name=orcl
control_files = (/u01/app/oracle/oradata/orcl/desk1/ora_control1.ctl,/u01/app/oracle/oradata/orcl/desk2/ora_control2.ctl,/u01/app/oracle/oradata/orcl/desk3/ora_control3.ctl)
sga_target=400m
sga_max_size=400m
undo_management=auto
undo_tablespace=undotbs 
[oracle@ocm1 dbs]$ orapwd file=orapworcl password=system
[oracle@ocm1 dbs]$ ls
initdw.ora  init.ora  initorcl.ora  orapworcl
[oracle@ocm1 dbs]$ cd
[oracle@ocm1 dbs]$ cd
[oracle@ocm1 ~]$ vi test.sql
CREATE DATABASE orcl
   USER SYS IDENTIFIED BY system
   USER SYSTEM IDENTIFIED BY system
   LOGFILE GROUP 1 ('/u01/app/oracle/oradata/orcl/desk1/redo01a.log','/u01/app/oracle/oradata/orcl/desk2/redo01b.log') SIZE 100M,
           GROUP 2 ('/u01/app/oracle/oradata/orcl/desk2/redo02a.lo','/u01/app/oracle/oradata/orcl/desk3/redo02b.log') SIZE 100M, 
           GROUP 3 ('/u01/app/oracle/oradata/orcl/desk3/redo03a.log','/u01/app/oracle/oradata/orcl/desk4/redo03b.log') SIZE 100M
   MAXLOGFILES 20
   MAXLOGMEMBERS 5
   MAXLOGHISTORY 1
   MAXDATAFILES 1000
   MAXINSTANCES 1
   CHARACTER SET US7ASCII
   NATIONAL CHARACTER SET AL16UTF16
   DATAFILE '/u01/app/oracle/oradata/orcl/system01.dbf' SIZE 325M REUSE
   EXTENT MANAGEMENT LOCAL
   SYSAUX DATAFILE '/u01/app/oracle/oradata/orcl/sysaux01.dbf' SIZE 325M REUSE
   --DEFAULT TABLESPACE tbs_1         由于没有设定OMF所以注释掉
   DEFAULT TEMPORARY TABLESPACE tempts1
      TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf'
      SIZE 20M REUSE
   UNDO TABLESPACE undotbs
      DATAFILE '/u01/app/oracle/oradata/orcl/undotbs01.dbf'
      SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

[oracle@ocm1 ~]$ export ORACLE_SID=orcl
[oracle@ocm1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 1 21:54:13 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  419430400 bytes
Fixed Size                  1219784 bytes
Variable Size             121635640 bytes
Database Buffers          289406976 bytes
Redo Buffers                7168000 bytes
SQL> create spfile from pfile;

File created.

SQL> shutdown abort
ORACLE instance shut down.
SQL> !
[oracle@ocm1 ~]$ mkdir -p /u01/app/oracle/oradata/orcl/desk1
[oracle@ocm1 ~]$ mkdir -p /u01/app/oracle/oradata/orcl/desk2
[oracle@ocm1 ~]$ mkdir -p /u01/app/oracle/oradata/orcl/desk3
[oracle@ocm1 ~]$ mkdir -p /u01/app/oracle/oradata/orcl/desk4
[oracle@ocm1 ~]$ mkdir -p /u01/app/oracle/oradata/orcl/desk5
[oracle@ocm1 ~]$ mkdir -p /u01/app/oracle/admin/orcl/adump
[oracle@ocm1 ~]$ mkdir -p /u01/app/oracle/admin/orcl/bdump
[oracle@ocm1 ~]$ mkdir -p /u01/app/oracle/admin/orcl/cdump
[oracle@ocm1 ~]$ mkdir -p /u01/app/oracle/admin/orcl/udump
[oracle@ocm1 ~]$ exit
exit

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  419430400 bytes
Fixed Size                  1219784 bytes
Variable Size             121635640 bytes
Database Buffers          289406976 bytes
Redo Buffers                7168000 bytes
SQL> alter system set audit_file_dest='/u01/app/oracle/admin/orcl/adump' scope=spfile;

System altered.

SQL> alter system set background_dump_dest='/u01/app/oracle/admin/orcl/bdump' scope=spfile;

System altered.

SQL> alter system set core_dump_dest='/u01/app/oracle/admin/orcl/cdump' scope=spfile;

System altered.

SQL> alter system set user_dump_dest='/u01/app/oracle/admin/orcl/udump' scope=spfile;

System altered.
SQL> create pfile from spfile;

File created.

SQL> @test.sql

Database created.

 

[ 3]  Create and manage temporary, permanent, and undo tablespaces

 

SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
SQL> create temporary tablespace tempts2 tempfile '/u01/app/oracle/oradata/orcl/temp02.dbf' size 20m autoextend on

Tablespace created.

SQL> alter tablespace tempts2 tablespace group temp_group_1;

Tablespace altered.

SQL> alter tablespace tempts1 tablespace group temp_group_1;

Tablespace altered.

SQL> create tablespace tbs1 datafile '/u01/app/oracle/oradata/orcl/tbs01.dbf' size 20m autoextend on;

Tablespace created.

SQL> create tablespace undotbs2 datafile '/u01/app/oracle/oradata/orcl/undotbs201.dbf' size 50m autoextend on;

Tablespace created.

SQL> drop tablespace tbs1 including contents and datafiles;

Tablespace dropped.

SQL> create tablespace tbs1 datafile '/u01/app/oracle/oradata/orcl/tbs01.dbf' size 50m extent management local;

Tablespace created.

---创建一个本地段管理的表空间tbs2 uniform. 1m 表示每个段都1m大小默认也是1m

SQL> create tablespace tbs2 datafile '/u01/app/oracle/oradata/orcl/tbs201.dbf' size 50m extent management local uniform. size 1m;

Tablespace created.

---删除上面我们创建的一个后缀名不统一的logfile重新给增加一个

SQL> alter database drop logfile member '/u01/app/oracle/oradata/orcl/desk2/redo02a.lo';

Database altered.

SQL> alter database add logfile member '/u01/app/oracle/oradata/orcl/desk2/redo02a.log' to GROUP 2;

Database altered.


SQL> alter database add logfile group 4('/u01/app/oracle/oradata/orcl/desk4/redo04a.log') size 100m;

Database altered.

SQL> alter database add logfile member '/u01/app/oracle/oradata/orcl/desk5/redo04b.log' to group 4;

Database altered.


SQL> alter database add logfile group 5('/u01/app/oracle/oradata/orcl/desk5/redo05a.log','/u01/app/oracle/oradata/orcl/desk1/redo05b.log')
  2  size 100m;

Database altered.

SQL> 
[  ] Stripe data files across multiple physical devices and locations
SQL> alter tablespace tbs1 add datafile '/u01/app/oracle/oradata/orcl/desk1/tbs02.dbf' size 50m;

Tablespace altered.

SQL>

[  ] Configure the database environment to support optimal data access performance 

---在oracle 10.2中默认是使用 SEGMENT SPACE MANAGEMENT AUTO 让ASSM自动管理段,所以后面啥都没跟

SQL> create tablespace tbs3 datafile '/u01/app/oracle/oradata/orcl/tbs301.dbf' size 10m; 

Tablespace created.
SQL> set long 1000;
SQL> select dbms_metadata.get_ddl('TABLESPACE','TBS3') from dual;

DBMS_METADATA.GET_DDL('TABLESPACE','TBS3')
--------------------------------------------------------------------------------

  CREATE TABLESPACE "TBS3" DATAFILE
  '/u01/app/oracle/oradata/orcl/tbs301.dbf' SIZE 10485760
  LOGGING ONLINE PERMANENT BLOCKSIZE 8192
  EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO

 

1 row selected.

[ 4 ] Create and manage database configuration files
create pfile form. spfile;
create spfile from pfile;

[ 5 ] Create and manage bigfile tablespaces
SQL> create bigfile tablespace bgf datafile '/u01/app/oracle/oradata/orcl/bfile.dbf' size 50m;

Tablespace created.

SQL>

嗯,后面是大头的,listener 与tns配置 没配好一上午就白考了。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23754390/viewspace-739789/,如需转载,请注明出处,否则将追究法律责任。

上一篇: OCM考试-GC安装
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2010-04-19

  • 博文量
    93
  • 访问量
    152797