新加了一块盘做手工创建数据库的数据文件目录 oradata;
这台服务器上本来就有一个单机asm数据库,我内存不够先关闭了
[oracle@oomcserver ~]$ cp .bash_profile .bash_profile_omccdb
[oracle@oomcserver ~]$ vim .bash_profile
[oracle@oomcserver ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export ORACLE_SID=mandb
export PATH=$PATH:$ORACLE_HOME/bin
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export NLS_DATE_FORMAT
环境变量配置文件先备份,主要是修改ORACLE_SID 修改为mandb
这里不改动,略
[oracle@oomcserver dbs]$ vim initmandb.ora
[oracle@oomcserver dbs]$ cat initmandb.ora
db_name='mandb'
memory_target=1G
processes = 150
audit_file_dest='/admin/mandb/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='/oradata/mandb/recovery'
db_recovery_file_dest_size=2G
diagnostic_dest='/oradata/mandb/diag'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# You may want to ensure that control files are created on separate physical
# devices
control_files = (/oradata/mandb/control01.ctl,/oradata/mandb/control02.ctl)
compatible ='11.2.0'
初始化参数文件定义的目录若不存在则需要手工进行创建
mkdir -p /u01/app/oracle/admin/mandb/adump
mkdir -p /oradata/mandb/recovery
#防止adr报错
mkdir -p /oradata/mandb/diag
重要说明:若是Windows平台则在启动到NOMOUNT时需要先将实例注册成服务,命令如下
oradim -NEW -SID oracleSID -STARTMODE manual [oracleSID替换成您要注册的实例名称】
startup nomount
CREATE DATABASE mandb
USER SYS IDENTIFIED BY sys
USER SYSTEM IDENTIFIED BY system
LOGFILE GROUP 1 ('/oradata/mandb/redo01a.log') SIZE 50M ,
GROUP 2 ('/oradata/mandb/redo02a.log') SIZE 50M ,
GROUP 3 ('/oradata/mandb/redo03a.log') SIZE 50M
MAXLOGHISTORY 1
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 8192
Character set UTF8
EXTENT MANAGEMENT LOCAL
DATAFILE '/oradata/mandb/system01.dbf'
SIZE 700M AUTOEXTEND ON MAXSIZE 10G
SYSAUX DATAFILE '/oradata/mandb/sysaux01.dbf'
SIZE 550M AUTOEXTEND ON MAXSIZE 10G
DEFAULT TABLESPACE users
DATAFILE '/oradata/mandb/users01.dbf'
SIZE 100M AUTOEXTEND ON MAXSIZE 10G
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/oradata/mandb/temp01.dbf'
SIZE 200M AUTOEXTEND ON MAXSIZE 10G
UNDO TABLESPACE undotbs1
DATAFILE '/oradata/mandb/undotbs01.dbf'
SIZE 200M AUTOEXTEND ON MAXSIZE 10G;
--创建完成后查看数据库状态
select dbid,name,open_mode from v$database;
查看数据库状态,是按照我们建的路径(数据文件),读写状态
Create spfile from pfile;
create tablespace users datafile '/oradata/mandb/mantest.dbf' size 100M;
su - oracle
cd /u01/app/oracle/product/11.2.0/db_1/rdbms/admin
sqlplus / as sysdba
@catalog.sql
@catproc.sql
@pupbld.sql
执行过程略,很多等几分钟
select comp_id,version,status from dba_registry;
select owner,object_name,object_type from all_objects where status<>'VALID';
若有无效组件则跑utlrp.sql脚本
该脚本位于$ORACLE_HOME/rdbms/admin/utlrp.sql,同上操作
--重新启动
shutdown immediate
startup
ok,yeah 在把监听启动起来就行