Chinaunix首页 | 论坛 | 博客
  • 博客访问: 218034
  • 博文数量: 57
  • 博客积分: 1376
  • 博客等级: 中尉
  • 技术积分: 658
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-09 09:51
文章分类

全部博文(57)

文章存档

2012年(1)

2011年(56)

分类: Oracle

2011-02-22 20:33:59

1. Design the related file paths:

$ORACLE_BASE=/u01/app/oracle/
$ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
$ORACLE_SID=loveu

tracefile:
adump: /u01/app/oracle/admin/loveu/adump
bdump: /u01/app/oracle/admin/loveu/bdump
cdump: /u01/app/oracle/admin/loveu/cdump
udump: /u01/app/oracle/admin/loveu/udump

data file: /u01/app/oracle/oradata/loveu/

  1. [oracle@milo ~]$ mkdir -p /u01/app/oracle/admin/loveu/adump
  2. [oracle@milo ~]$ mkdir -p /u01/app/oracle/admin/loveu/bdump
  3. [oracle@milo ~]$ mkdir -p /u01/app/oracle/admin/loveu/cdump
  4. [oracle@milo ~]$ mkdir -p /u01/app/oracle/admin/loveu/udump
  5. [oracle@milo ~]$ mkdir -p /u01/app/oracle/oradata/loveu

2. Set the system env variable
  1. export ORACLE_SID=loveu

3. create the password file
  1. [oracle@milo ~]$ cd $ORACLE_HOME/dbs
  2. [oracle@milo dbs]$ orapwd
  3. Usage: orapwd file= password= entries= force=

  4. where
  5. file - name of password file (mand),
  6. password - password for SYS (mand),
  7. entries - maximum number of distinct DBA and force - whether to overwrite existing file (opt),
  8. OPERs (opt),
  9. There are no spaces around the equal-to (=) character.

  10. [oracle@milo dbs]$ ls orapw*
  11. orapwdemo orapworcl
  12. [oracle@milo dbs]$ orapwd file=orapwloveu password=milo
  13. [oracle@milo dbs]$ ll orapwloveu
  14. -rw-r----- 1 oracle oinstall 1536 Feb 22 20:52 orapwloveu

4.Prepare the parameter file:
  1. [oracle@milo dbs]$ pwd
  2. /u01/app/oracle/product/10.2.0/db_1/dbs
  3. [oracle@milo dbs]$ cat initloveu.ora
  4. compatible=10.2.0.1.0
  5. db_name=loveu
  6. shared_pool_size=300m
  7. audit_file_dest='/u01/app/oracle/admin/loveu/adump'
  8. background_dump_dest='/u01/app/oracle/admin/loveu/bdump'
  9. core_dump_dest='/u01/app/oracle/admin/loveu/cdump'
  10. user_dump_dest='/u01/app/oracle/admin/loveu/udump'
  11. control_files='/u01/app/oracle/oradata/loveu/control01.ctl', '/u01/app/oracle/oradata/loveu/control02.ctl'
  12. db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
  13. db_recovery_file_dest_size=400m
  14. undo_management=auto
  15. undo_tablespace=undotbs01

5. Startup the instance with your created parameter file
  1. [oracle@milo dbs]$ export ORACLE_SID=loveu
  2. [oracle@milo dbs]$ echo $ORACLE_SID
  3. loveu
  4. [oracle@milo dbs]$ sqlplus / as sysdba

  5. SQL*Plus: Release 10.2.0.1.0 - Production on Tue Feb 22 21:38:53 2011

  6. Copyright (c) 1982, 2005, Oracle. All rights reserved.

  7. Connected to an idle instance.

  8. SQL> startup nomount
  9. ORACLE instance started.

  10. Total System Global Area 398458880 bytes
  11. Fixed Size 1219616 bytes
  12. Variable Size 339739616 bytes
  13. Database Buffers 50331648 bytes
  14. Redo Buffers 7168000 bytes
  15. SQL> show parameter name

  16. NAME TYPE VALUE
  17. ------------------------------------ ----------- ------------------------------
  18. db_file_name_convert string
  19. db_name string loveu
  20. db_unique_name string loveu
  21. global_names boolean FALSE
  22. instance_name string loveu
  23. lock_name_space string
  24. log_file_name_convert string
  25. service_names string loveu
  26. SQL>

6. Create database
SQL> select open_mode from v$database;
select open_mode from v$database
                      *
ERROR at line 1:
ORA-01507: database not mounted


Note: if sometimes you failed too much time, then you'd better shutdown the instance and startup the instance and do the creation operation immediately.

  1. SQL> r
  2.   1 create database loveu
  3.   2 maxinstances 8
  4.   3 maxloghistory 1
  5.   4 maxlogfiles 16
  6.   5 maxlogmembers 3
  7.   6 maxdatafiles 100
  8.   7 datafile '/u01/app/oracle/oradata/loveu/system01.dbf' size 300m autoextend on extent management local
  9.   8 sysaux datafile '/u01/app/oracle/oradata/loveu/sysaux01.dbf' size 120m autoextend on
  10.   9 default temporary tablespace temp tempfile '/u01/app/oracle/oradata/loveu/temp01.dbf' size 20m
  11.  10 undo tablespace undotbs01 datafile '/u01/app/oracle/oradata/loveu/undotbs01.dbf' size 40m
  12.  11 character set we8iso8859p1
  13.  12 national character set al16utf16
  14.  13 logfile
  15.  14 group 1 '/u01/app/oracle/oradata/loveu/redo01.log' size 50m,
  16.  15* group 2 '/u01/app/oracle/oradata/loveu/redo02.log' size 50m

  17. Database created.

create the data dictioinary:
  1. SQL> @?/rdbms/admin/catalog
create the related pl/sql evn:
  1. SQL> @?/rdbms/admin/catproc

  1. SQL> alter database open;
  2. alter database open
  3. *
  4. ERROR at line 1:
  5. ORA-01531: a database already open by the instance


  6. SQL> select open_mode from v$database;

  7. OPEN_MODE
  8. ----------
  9. READ WRITE

  10. 1 row selected.

  1. SQL> select instance_name, status from v$instance;

  2. INSTANCE_NAME STATUS
  3. ---------------- ------------
  4. loveu OPEN

  5. 1 row selected.


A tiny problem will happen if you're not load a script
  1. SQL> grant connect, resource to milo;

  2. Grant succeeded.

  3. SQL> conn milo/milo;
  4. Error accessing PRODUCT_USER_PROFILE
  5. Warning: Product user profile information not
  6. You may need to run PUPBLD.SQL as SYSTEM
  7. Connected.

  8. SQL> conn system/oracle
  9. Connected.
  10. SQL> @?/sqlplus/admin/pupbld.sql
  11. SQL> conn milo/milo;
  12. Connected.


阅读(2122) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~