专注于数据库技术研究和实践,目前就职于互联网金融企业,提供Oracle数据库技术支持和维护。 联系电话:18616803656
分类: Oracle
2011-06-04 18:37:46
create directory
$ mkdir /u01/app/oracle/admin/dblife/udump -p
$ mkdir /u01/app/oracle/admin/dblife/cdump
$ mkdir /u01/app/oracle/admin/dblife/bdump
$ mkdir /u01/oradata/dblife -p
create password file
$ cd $ORACLE_HOME/dbs
$ orapwd file=orapwdblife password=oracle
create parameter file
$ cat > initdblife.ora <
db_files = 80 # SMALL
db_file_multiblock_read_count = 8 # SMALL
#db_block_buffers = 100 # SMALL
#shared_pool_size = 3500000 # SMALL
log_checkpoint_interval = 10000
processes = 50 # SMALL
parallel_max_servers = 5 # SMALL
#log_buffer = 32768 # SMALL
max_dump_file_size = 10240 # limit trace file size to 5 Meg each
global_names = TRUE
control_files = ('/u01/oradata/control01.ctl', '/u01/oradata/control02.ctl')
sga_target=400m
background_dump_dest=/u01/app/oracle/admin/dblife/bdump
core_dump_dest=/u01/app/oracle/admin/dblife/cdump
user_dump_dest=/u01/app/oracle/admin/dblife/udump
undo_management=auto
undo_tablespace=undotbs
EOF
create create database script
$ cat > db.sql <
user sys identified by oracle
user system identified by oracle
maxinstances 2
maxdatafiles 2048
maxlogmembers 5
maxloghistory 20
datafile '/u01/oradata/dblife/system01.dbf' size 300m autoextend on next 30m maxsize unlimited
sysaux datafile '/u01/oradata/dblife/sysaux01.dbf' size 300m autoextend on next 30m maxsize unlimited
default temporary tablespace temp tempfile '/u01/oradata/dblife/temp01.dbf' size 200m
undo tablespace undotbs datafile '/u01/oradata/dblife/undotbs01.dbf' size 100m autoextend on next 10m maxsize unlimited
default tablespace users datafile '/u01/oradata/dblife/users01.dbf' size 100m
logfile
group 1 ('/u01/oradata/dblife/redo1_1.rdo','/u01/oradata/dblife/redo1_2.rdo') size 20m,
group 2 ('/u01/oradata/dblife/redo2_1.rdo','/u01/oradata/dblife/redo2_2.rdo') size 20m,
group 3 ('/u01/oradata/dblife/redo3_1.rdo','/u01/oradata/dblife/redo3_2.rdo') size 20m;
EOF
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jun 4 18:36:08 2011
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 1219736 bytes
Variable Size 121635688 bytes
Database Buffers 289406976 bytes
Redo Buffers 7168000 bytes
SQL> @db
Database created.
SQL> @?/rdbms/admin/catalog --创建数据字典
SQL> @?/rdbms/admin/catproc --创建package包
SQL> @?/rdbms/admin/catblock.sql --创建锁相关的几个视图
SQL> @?/rdbms/admin/catoctk.sql --创建密码工具包dbms_crypto_toolkit
SQL> @?/rdbms/admin/owminst.plb --创建工作空间管理相关对象,如dmbs_wm
SQL> conn system/oracle --创建sqlplus属性和帮助
SQL> @?/sqlplus/admin/pupbld
SQL> @?/sqlplus/admin/help/hlpbld.sql helpus.sql
SQL> exit
开启归档模式
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> create spfile from pfile;
File created.
SQL> startup mount
ORACLE instance started.
Total System Global Area 419430400 bytes
Fixed Size 1219736 bytes
Variable Size 121635688 bytes
Database Buffers 289406976 bytes
Redo Buffers 7168000 bytes
Database mounted.
SQL> alter system set log_archive_dest_1='LOCATION=/u01/archivelog' scope=spfile;
System altered.
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/archivelog
Oldest online log sequence 22
Next log sequence to archive 24
Current log sequence 24
SQL> ! mkdir /u01/archivelog
SQL> alter system switch logfile;
System altered.
SQL> ! ls /u01/archivelog
1_24_752956580.dbf
检查数据库
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/oradata/dblife/system01.dbf
/u01/oradata/dblife/undotbs01.dbf
/u01/oradata/dblife/sysaux01.dbf
/u01/oradata/dblife/users01.dbf
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u01/oradata/control01.ctl
/u01/oradata/control02.ctl
SQL> select name from v$tempfile;
NAME
--------------------------------------------------------------------------------
/u01/oradata/dblife/temp01.dbf
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/u01/oradata/dblife/redo1_1.rdo
/u01/oradata/dblife/redo1_2.rdo
/u01/oradata/dblife/redo2_1.rdo
/u01/oradata/dblife/redo2_2.rdo
/u01/oradata/dblife/redo3_1.rdo
/u01/oradata/dblife/redo3_2.rdo
6 rows selected.
建立和配置EM
SQL> @?/sysman/admin/emdrep/sql/emreposcre /u01/app/oracle/product/10.2.0/db_1 SYSMAN iamwangnc TEMP ON;
SQL> alter user SYSMAN identified by "oracle" account unlock;
SQL> alter user DBSNMP identified by "oracle" account unlock;
SQL> alter system set job_queue_processes=5;
SQL> emca -config dbcontrol db -silent -DB_UNIQUE_NAME dblife -PORT 1521 -EM_HOME /u01/app/oracle/product/10.2.0/db_1 -LISTENER LISTENER -SERVICE_NAME dblife -SYS_PWD "oracle" -SID dblife -ORACLE_HOME /u01/app/oracle/product/10.2.0/db_1 -DBSNMP_PWD "oracle" -HOST "dblife10.lsp.com" -LISTENER_OH /u01/app/oracle/product/10.2.0/db_1 -LOG_FILE /u01/app/oracle/emConfig.log -SYSMAN_PWD "oracle";
访问