ITPub博客

首页 > Linux操作系统 > Linux操作系统 > manual database creation for oracle10g on solaris10

manual database creation for oracle10g on solaris10

原创 Linux操作系统 作者:wisdomone1 时间:2010-01-19 12:04:20 0 删除 编辑
1,配置ORACLE_SID

bash-3.00$ export ORACLE_SID=mynewdb

2,切到dbs目录
bash-3.00$ cd $ORACLE_HOME/dbs
bash-3.00$ ls
init.ora    initdw.ora
bash-3.00$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.2.0 - Production on Mon Dec 14 20:24:04 2009

Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup nomount    
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/export/home/orainstall/oracle/product/10.2.0/db_1/dbs/initmanualdb.ora'
SQL> exit
Disconnected
bash-3.00$ pwd
/export/home/orainstall/oracle/product/10.2.0/db_1/dbs

3,生成一个pfile文件,以初始init.ora为基础
bash-3.00$ cp -p init.ora initmanualdb.ora  ---在init.ora文件中添加undo_management=auto
bash-3.00$ sqlplus "/as sysdba"

SQL*Plus: Release 10.2.0.2.0 - Production on Mon Dec 14 20:24:56 2009

Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup nomount  ---因生成的pfile文件此值太小,加大就可;且在此pfile末加上control_files
ORA-00371: not enough shared pool memory, should be atleast 62198988 bytes
SQL> exit
Disconnected
bash-3.00$ ls
init.ora          init.ora.bak      initdw.ora        initmanualdb.ora

SQL> startup nomount --再次nomount
ORACLE instance started.

Total System Global Area  100663296 bytes
Fixed Size                  1278688 bytes
Variable Size              88083744 bytes
Database Buffers            8388608 bytes
Redo Buffers                2912256 bytes
SQL> show parameter control

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
control_file_record_keep_time        integer
7
control_files                        string
/export/home/orainstall/oracle
/product/10.2.0/db_1/dbs/ora_c
ontrol1, /export/home/orainsta
ll/oracle/product/10.2.0/db_1/
dbs/ora_control2, /export/home
/orainstall/control01.dbf, /ex

NAME                                 TYPE
------------------------------------ ----------------------
VALUE
------------------------------
port/home/orainstall/control02
.dbf


4,根据pfile生成spfile,关闭库

SQL> create spfile from pfile;--生成spfile

File created.

SQL> shutdown immediate
ORA-01507: database not mounted


ORACLE instance shut down.


5,创建数据库

    
SQL> startup  nomount
ORACLE instance started.

Total System Global Area  100663296 bytes
Fixed Size                  1278688 bytes
Variable Size              88083744 bytes
Database Buffers            8388608 bytes
Redo Buffers                2912256 bytes
SQL> create database manualdb
  2  user sys identified by sex
  3  user system identified by sex
  4  logfile group 1 '/export/home/orainstall/redo01.log' size 50m,  --注意关键字logfile group
  5          group 2 '/export/home/orainstall/redo02.log' size 50m
  6  maxlogfiles 5
  7  maxlogmembers 5
  8  maxloghistory 1
  9  maxdatafiles 100
 10  character set US7ASCII
 11  NATIONAL character set al16utf16
 12  datafile '/export/home/orainstall/system01.dbf' size 300m reuse
 13  extent management local
 14  sysaux datafile '/export/home/orainstall/sysaux01.dbf' size 300m  reuse
 15  default tablespace tbs_1
 16  datafile '/export/home/orainstall/tbs01.dbf' size 100m reuse  --注意:为默认表空间添加对应的datafile,不然会报相关的sql.bsq错误
 17  default temporary tablespace tempts1
 18  tempfile '/export/home/orainstall/temp01.dbf' size 20m reuse
 19  undo tablespace undotbs
 20  DATAFILE '/export/home/orainstall/undotbs01.dbf'
 21  SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

Database created.


6,运行catalog.sql,生成数据字典及动态性能视图
SQL> @?/rdbms/admin/catalog.sql
DOC>######################################################################
DOC>######################################################################
DOC>    The following statement will cause an "ORA-01722: invalid number"
DOC>    error and terminate the SQLPLUS session if the user is not SYS.
DOC>    Disconnect and reconnect with AS SYSDBA.
DOC>######################################################################
DOC>######################################################################
DOC>#

no rows selected


7,运行catproc.sql,生成plsql包相关过程
SQL> @?/rdbms/admin/catproc.sql




手工删除数据库

1,预备条件:以exclusive启动数据库到mount,且启用restricted session

-bash-3.00$ export ORACLE_SID=manualdb
-bash-3.00$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.2.0 - Production on Tue Dec 15 10:09:56 2009

Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup mount exclusive
ORACLE instance started.

Total System Global Area  100663296 bytes
Fixed Size                  1278688 bytes
Variable Size              88083744 bytes
Database Buffers            8388608 bytes
Redo Buffers                2912256 bytes
Database mounted.
SQL> alter system enable restricted session;

System altered.


2,drop database
SQL> drop database;

Database dropped.

Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> exit

3,后记:只是删除数据文件,日志文件,控制文件;对于生成的归档日志没有影响,可以通过rman操作归档日志
 

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

请登录后发表评论 登录
全部评论
提供针对oracle初学者及进阶的数据库培训,欢迎大家咨询: 微信: wisdomone 微信公众号: lovedb 工作经历: 中国普天 北京科蓝 北京云和恩墨 北京神州新桥

注册时间:2008-04-04

  • 博文量
    2189
  • 访问量
    12689906