手工建库前必须安装好oracle软件
-、手动建库
(Instance + Database, Instance:进程+内存,Database:文件,数据文件+控制文件+Redo文件+其他文件)
(1)、启动实例(spfile)
(2)、建库
(3)、跑脚本
1.参数设置(文档位置:Reference -->1 Initialization Parameters -->Basic Initialization Parameters)
--创建数据库所需要的目录
mkdir -p /u01/app/oracle/admin/manual/adump
mkdir -p /u01/app/oracle/oradata/manual/
mkdir -p /u01/app/oracle/flash_recovery_area
vi profile.ora
CLUSTER_DATABASE=false
COMPATIBLE='11.2.0.0.0'
CONTROL_FILES='/u01/app/oracle/oradata/manual/control01.ctl','/u01/app/oracle/flash_recovery_area/erp/control02.ctl'
DB_BLOCK_SIZE=8192
DB_CREATE_FILE_DEST='/u01/app/oracle/oradata/manual/'
DB_NAME='manual'
DB_RECOVERY_FILE_DEST='/u01/app/oracle/flash_recovery_are'
DB_RECOVERY_FILE_DEST_SIZE=8G
DB_UNIQUE_NAME=manual
OPEN_CURSORS=300
PGA_AGGREGATE_TARGET=300M
PROCESSES=800
REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE'
SESSIONS=1000
SGA_TARGET=600M
UNDO_TABLESPACE='undotbs1'
环境变量
export ORACLE_SID=manual
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=american_america.ZHS16GBK
2.建库命令(文档位置:Administrator's Guide --> 2 Creating an Oracle Database -->Manually Creating an Oracle Database -->Step 7: Issue the CREATE DATABASE Statement) '
CREATE DATABASE manual
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/manual/redo01.log') SIZE 60M,
GROUP 2 ('/u01/app/oracle/oradata/manual/redo02.log') SIZE 60M,
GROUP 3 ('/u01/app/oracle/oradata/manual/redo03.log') SIZE 60M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII --建议使用这个:AL32UTF8
NATIONAL CHARACTER SET AL16UTF16 --建议使用这个AL16UTF16
DATAFILE '/u01/app/oracle/oradata/manual/system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/u01/app/oracle/oradata/manual/sysaux01.dbf' SIZE 100M REUSE
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/manual/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/u01/app/oracle/oradata/manual/undotbs01.dbf'
SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
/*
--启动数据库到mount状态
[oracle@felix u01]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Dec 16 12:13:57 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount pfile='/u01/pfile.ora';
ORACLE instance started.
Total System Global Area 208769024 bytes
Fixed Size 2226936 bytes
Variable Size 180356360 bytes
Database Buffers 20971520 bytes
Redo Buffers 5214208 bytes
--创建数据库:
SQL> CREATE DATABASE manual
2 USER SYS IDENTIFIED BY oracle
3 USER SYSTEM IDENTIFIED BY oracle
4 LOGFILE GROUP 1 ('/u01/app/oracle/oradata/manual/redo01.log') SIZE 60M,
5 GROUP 2 ('/u01/app/oracle/oradata/manual/redo02.log') SIZE 60M,
6 GROUP 3 ('/u01/app/oracle/oradata/manual/redo03.log') SIZE 60M
7 MAXLOGFILES 5
8 MAXLOGMEMBERS 5
9 MAXLOGHISTORY 1
10 MAXDATAFILES 100
11 MAXINSTANCES 1
12 CHARACTER SET US7ASCII
13 NATIONAL CHARACTER SET AL16UTF16
14 DATAFILE '/u01/app/oracle/oradata/manual/system01.dbf' SIZE 325M REUSE
15 EXTENT MANAGEMENT LOCAL
16 SYSAUX DATAFILE '/u01/app/oracle/oradata/manual/sysaux01.dbf' SIZE 100M REUSE
17 DEFAULT TEMPORARY TABLESPACE tempts1
18 TEMPFILE '/u01/app/oracle/oradata/manual/temp01.dbf'
19 SIZE 20M REUSE
20 UNDO TABLESPACE undotbs1
21 DATAFILE '/u01/app/oracle/oradata/manual/undotbs01.dbf'
22 SIZE 100M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
Database created.
SQL>
*/
3.跑脚本(文档位置:Administrator's Guide --> 2 Creating an Oracle Database -->Manually Creating an Oracle Database --Step 9: Run Scripts to Build Data Dictionary Views)'
oracle的rdbms目录下得更多介绍
1.--执行这个脚本后,创建数据库的统计视图,审计视图。
@?/rdbms/admin/catalog.sql
2.--执行这个脚本后,数据库具有导入导出功能,即可以使用exp、imp、expdp、impdp。
@?/rdbms/admin/catexp.sql
3.--数据库具有pl/sql的使用功能。
@?/rdbms/admin/catproc.sql
4.--创建审计数据字典视图
@?/rdbms/admin/cataudit.sql
[oracle@mydb ~]$ sqlplus / as sysdba
SQL> startup nomount pfile='/u01/pfile.ora';
Total System Global Area 524288000 bytes
Fixed Size 2022048 bytes
Variable Size 146802016 bytes
Database Buffers 373293056 bytes
Redo Buffers 2170880 bytes
SQL> create spfile from pfile='/u01/pfile.ora';
File created.
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup nomount;
[oracle@felix ~]$ ps -ef|grep ora_
oracle 10075 1 0 15:55 ? 00:00:00 ora_pmon_manual
oracle 10077 1 0 15:55 ? 00:00:00 ora_psp0_manual
oracle 10079 1 10 15:55 ? 00:01:44 ora_vktm_manual
oracle 10083 1 0 15:55 ? 00:00:00 ora_gen0_manual
oracle 10085 1 0 15:55 ? 00:00:00 ora_diag_manual
oracle 10087 1 0 15:55 ? 00:00:00 ora_dbrm_manual
oracle 10089 1 0 15:55 ? 00:00:01 ora_dia0_manual
oracle 10091 1 0 15:55 ? 00:00:00 ora_mman_manual
oracle 10093 1 0 15:55 ? 00:00:01 ora_dbw0_manual
oracle 10095 1 0 15:55 ? 00:00:09 ora_lgwr_manual
oracle 10097 1 0 15:55 ? 00:00:00 ora_ckpt_manual
oracle 10099 1 0 15:55 ? 00:00:00 ora_smon_manual
oracle 10101 1 0 15:55 ? 00:00:00 ora_reco_manual
oracle 10103 1 0 15:55 ? 00:00:01 ora_mmon_manual
oracle 10105 1 0 15:55 ? 00:00:01 ora_mmnl_manual
oracle 10113 1 0 15:55 ? 00:00:00 ora_qmnc_manual
oracle 10125 1 0 15:55 ? 00:00:03 ora_q000_manual
oracle 10127 1 0 15:55 ? 00:00:00 ora_q001_manual
oracle 10161 1 0 15:59 ? 00:00:00 ora_smco_manual
oracle 10163 1 0 15:59 ? 00:00:00 ora_w000_manual
oracle 10227 1 0 16:04 ? 00:00:00 ora_w001_manual
oracle 10231 1 0 16:04 ? 00:00:00 ora_w002_manual
oracle 10249 1 0 16:06 ? 00:00:00 ora_cjq0_manual
oracle 10283 1 0 16:09 ? 00:00:00 ora_w003_manual
oracle 10297 1 0 16:11 ? 00:00:00 ora_w004_manual
oracle 10305 1 0 16:11 ? 00:00:00 ora_w005_manual
oracle 10307 1 0 16:11 ? 00:00:00 ora_w006_manual
oracle 10320 9854 0 16:12 pts/3 00:00:00 grep ora_
[oracle@felix ~]$
进程都起来了
SQL> show parameter dump
NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
background_core_dump string partial
background_dump_dest string /u01/app/oracle/diag/rdbms/man
ual/manual/trace
core_dump_dest string /u01/app/oracle/diag/rdbms/man
ual/manual/cdump
max_dump_file_size string unlimited
shadow_core_dump string partial
user_dump_dest string /u01/app/oracle/diag/rdbms/man
ual/manual/trace
查看告警日志
[oracle@mydb log]$ tail -f alert_PROD.log