本文主要是介绍linux下 oracle 11g 手工建库,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
实例名export ORACLE_SID=mypl
mkdir /u01/app/oracle/product/admin/adump -p
mkdir /u01/app/oracle/product/admin/bdump -p
mkdir /u01/app/oracle/product/admin/cdump -p
mkdir /u01/app/oracle/product/admin/udump -p
mkdir /u01/app/oracle/product/admin/pfile -p
mkdir /u01/app/oracle/product/admin/create -p
mkdir /u01/app/oracle/oradata/mypl
创建密码文件
orapwd file=/u01/app/oracle/product/11.2.0/dbs/orapwmypl password=oracle;
创建启动实例文件
[root@orale app]# chown -R oracle:oinstall /u01/app/
[root@orale app]# chmod -R 775 /u01/app/
[oracle@orale app]$ cat >aaa.ora
db_name=mypl
control_files=(/u01/app/oracle/oradata/contro01.ctl)
进入SQL创建指定实例启动文件
[oracle@orale app]$ lsnrctl start
[oracle@orale app]$ sqlplus / as sysdba;
SQL>create spfile from pfile='/u01/app/aaa.ora';
File created.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 146472960 bytes
Fixed Size 1335080 bytes
Variable Size 92274904 bytes
Database Buffers 50331648 bytes
Redo Buffers 2531328 bytes
执行脚本创建数据库(注下面参数是给虚拟机配置的):
SQL>
CREATE DATABASE mypl
USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/mypl/redo01.log') SIZE 50M,
GROUP 2 ('/u01/app/oracle/oradata/mypl/redo02.log') SIZE 50M,
GROUP 3 ('/u01/app/oracle/oradata/mypl/redo03.log') SIZE 50M
MAXLOGFILES 20
MAXLOGMEMBERS 5
MAXLOGHISTORY 200
MAXDATAFILES 100
CHARACTER SET ZHS16GBK
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/mypl/system01.dbf' SIZE 500M REUSE
SYSAUX DATAFILE '/u01/app/oracle/oradata/mypl/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TEMPORARY TABLESPACE temp
TEMPFILE '/u01/app/oracle/oradata/mypl/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs1
DATAFILE '/u01/app/oracle/oradata/mypl/undotbs01.dbf'
SIZE 200M REUSE;
Step 10: Create Additional Tablespaces
SQL> create tablespace users datafile '/u01/app/oracle/oradata/ocm/users01.dbf' size 50M;
Tablespace created.
SQL> alter database default tablespace users;
Database altered.
执行下面三个脚本(注第三个需要用system用户执行)
SQL> @?/rdbms/admin/catalog.sql
SQL> @?/rdbms/admin/catproc.sql
SQL> @?/sqlplus/admin/pupbld.sql分配内存
SQL> show parameter db_cache_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_cache_size big integer 48M
gyj@OCM> alter system set sga_max_size=800M scope=spfile;
System altered.
SQL>alter system set sga_max_size=600M scope=spfile;
SQL> shutdown immediate;
SQL> startup
SQL>alter system set db_cache_size=200M;
到这就已经建库完成了
以上的参数及以下均是抄袭的
删除数据库:因使用手工创建的数据库使用DBCA无法删除,此时需要使用命令来删除数据库。
使用以下三个命令即可:startup mount exclusive
alter system enable restricted session;
drop database;
数据库相应的控制文件,日志文件,数据文件会自动删除,spfile也会删除(归档日志不会删除).
手工建库时的ALERT日志
[oracle@bys3 ~]$ find /u01/ -name alert_*
/u01/app/oracle/diag/rdbms/mypl/mypl/trace/alert_mypl.log
/u01/app/oracle/diag/rdbms/mypl/plocp/trace/alert_plocp.log
[oracle@bys3 ~]$ cat alert_mypl.log
这篇关于linux下 oracle 11g 手工建库的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!