Presentation is loading. Please wait.

Presentation is loading. Please wait.

4 Copyright © Oracle Corporation, 2001. All rights reserved. 数据库创建.

Similar presentations


Presentation on theme: "4 Copyright © Oracle Corporation, 2001. All rights reserved. 数据库创建."— Presentation transcript:

1 4 Copyright © Oracle Corporation, 2001. All rights reserved. 数据库创建

2 4-2 Copyright © Oracle Corporation, 2001. All rights reserved. 目标 学完这个课程,你应该可以掌握你下内容 : 理解数据库创建的先决条件和需求 创建一个可以使用的数据库 Configuration Assistant 人为手工创建一个数据库 创建一个使用 Oracle 管理文件的数据库

3 4-3 Copyright © Oracle Corporation, 2001. All rights reserved. 管理和组织一个 Database 在管理数据库系统中计划是第一个步骤 – 定义数据的使用目的 – 定义数据库类型 – 标示一个数据库体系结构设计的要点 – 选择数据库的名字 创建你的个性化数据库 数据库升级助手( Oracle Data Migration Assistant ) 是被使用于从先前的低版本向高版本升级和移植

4 4-4 Copyright © Oracle Corporation, 2001. All rights reserved. Optimal Flexible Architecture (OFA) Oracle 推荐的标准的数据体系结构布局 OFA 包含三个主要的特点 : –Establish a directory structure where any database file can be stored on any disk resource. –Separate objects with different behavior into different tablespaces. –Maximize database reliability and performance by separating database components across different disk resources.

5 4-5 Copyright © Oracle Corporation, 2001. All rights reserved. oracle_base / product /admin /inst_name /pfile /release_number /bin /dbs /rdbms /sqlplus Software oradata/ db01/ system01.dbf control01.ctl redo0101.log... db02/ system01.dbf control01.ctl redo0101.log... Files Oracle Software and File Locations

6 4-6 Copyright © Oracle Corporation, 2001. All rights reserved. 创建先决条件 创建一个新的数据库,你必须做以下几点 : A privileged account authenticated by one of the following: –Operating system –Password file Sufficient memory to start the instance Sufficient disk space for the planned database

7 4-7 Copyright © Oracle Corporation, 2001. All rights reserved. 远程数据库管理本地数据库管理 Yes No Do you have a secure connection? Use OS authentication Use a password file 数据库管理员的鉴定方法 Do you want to use OS authentication?

8 4-8 Copyright © Oracle Corporation, 2001. All rights reserved. Using Password File Authentication Create the password file using the password utility Set REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE in initialization parameter file Add users to the password file Assign appropriate privileges to each user $ orapwd file=$ORACLE_HOME/dbs/orapwU15 password=admin entries=5 GRANT SYSDBA TO HR;

9 4-9 Copyright © Oracle Corporation, 2001. All rights reserved.

10 4-10 Copyright © Oracle Corporation, 2001. All rights reserved. 创建一个数据库 可以通过以下几个方法来创建数据库 : Oracle Universal Installer Oracle Database Configuration Assistant –Graphical user interface –Java-based –Launched by the Oracle Universal Installer –Can be used as a standalone The CREATE DATABASE command

11 4-11 Copyright © Oracle Corporation, 2001. All rights reserved. 操作系统环境变量 设置以下环境变量 : ORACLE_BASE ORACLE_HOME ORACLE_SID ORA_NLS33 PATH LD_LIBRARY_PATH

12 4-12 Copyright © Oracle Corporation, 2001. All rights reserved. Database Configuration Assistant 数据库配置助手可以做如下事情 : 创建一个数据库 配置数据库的选项 删除一个数据库 管理模版 –Create new template using pre-defined template settings –Create new template from an existing database –Delete database template

13 4-13 Copyright © Oracle Corporation, 2001. All rights reserved. 使用数据配置助手来创建数据库 从预定义的模版中选择一个数据库类型 定义全局的数据库名字和 SID 选择数据库的功能 标示在创建数据库后需要运行的脚本 选择你要运行的数据库模式

14 4-14 Copyright © Oracle Corporation, 2001. All rights reserved.

15 4-15 Copyright © Oracle Corporation, 2001. All rights reserved. 使用数据配置助手来创建数据库 标示 memory, archiving, database sizing, and file locations 选项 定义数据库存储参数 如果有需要,改变文件路径变量 选择数据库创建的选项完成数据库创建

16 4-16 Copyright © Oracle Corporation, 2001. All rights reserved.

17 4-17 Copyright © Oracle Corporation, 2001. All rights reserved. 手工方式创建数据库 选择一个唯一的事例和数据库名字. 选择一个数据库的字符集. 设置操作系统环境变量. 创建一个初始化参数文件. 启动一个事例在 NOMOUNT 状态. 创建并且执行 CREATE DATABASE 命令. 打开数据库. 运行生成数据字典的脚本和完成创建后的后续步骤 创建用户需求的表空间.

18 4-18 Copyright © Oracle Corporation, 2001. All rights reserved.

19 4-19 Copyright © Oracle Corporation, 2001. All rights reserved.

20 4-20 Copyright © Oracle Corporation, 2001. All rights reserved. 创建数据库 CREATE DATABASE user01 LOGFILE GROUP 1 ('/$HOME/ORADATA/u01/redo01.log') SIZE 100M, GROUP 2 ('/$HOME/ORADATA/u02/redo02.log') SIZE 100M, GROUP 3 ('/$HOME/ORADATA/u03/redo03.log') SIZE 100M MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 MAXINSTANCES 1 DATAFILE '/$HOME/ORADATA/u01/system01.dbf' SIZE 325M UNDO TABLESPACE undotbs DATAFILE '/$HOME/ORADATA/u02/undotbs01.dbf' SIZE 200M AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED DEFAULT TEMPORARY TABLESPACE temp CHARACTER SET US7ASCII NATIONAL CHARACTER SET AL16UTF16 SET TIME_ZONE= 'America/New_York'

21 4-21 Copyright © Oracle Corporation, 2001. All rights reserved.

22 4-22 Copyright © Oracle Corporation, 2001. All rights reserved.

23 4-23 Copyright © Oracle Corporation, 2001. All rights reserved. Creating a Database Using Oracle Managed Files (OMF) Using OMF simplifies file administration on the operating system OMF are created and deleted by the Oracle server as directed by SQL commands OMF are established by setting two parameters: – DB_CREATE_FILE_DEST : Set to give the default location for datafiles – DB_CREATE_ONLINE_LOG_DEST_N : Set to give the default locations for online redo logs and control files Maximum of five locations

24 4-24 Copyright © Oracle Corporation, 2001. All rights reserved.

25 4-25 Copyright © Oracle Corporation, 2001. All rights reserved. Creating a Database Using Oracle Managed Files (OMF) Define the OMF parameters in the initialization parameter file. Example: – DB_CREATE_FILE_DEST=/$HOME/ORADATA/u05 – DB_CREATE_ONLINE_DEST_1=/$HOME/ORADATA/u01 – DB_CREATE_ONLINE_DEST_2=/$HOME/ORADATA/u02 CREATE DATABASE command is simplified: @cddba01.sql > CREATE DATABASE dba01;

26 4-26 Copyright © Oracle Corporation, 2001. All rights reserved.

27 4-27 Copyright © Oracle Corporation, 2001. All rights reserved. 故障排除 如果发生以下情况,数据库创建失败 : SQL 存在语法错误 被创建的文件已经存在 操作系统错误如文件,目录权限以及空间不足等错误发生

28 4-28 Copyright © Oracle Corporation, 2001. All rights reserved. 数据库创建之后 数据库包含 : Datafiles, control files, and redo log files User SYS with the password change_on_install User SYSTEM with the password manager Internal tables (but no data dictionary views)

29 4-29 Copyright © Oracle Corporation, 2001. All rights reserved. 总结 In this lesson, you should have learned to: Identify the prerequisites for creating a database Create a database using the Oracle Database Configuration Assistant Create a database manually Create a database using Oracle Managed Files

30 4-30 Copyright © Oracle Corporation, 2001. All rights reserved. Practice 4 Overview This lesson provides two specific ways to creating a database: –Use the Database Configuration Assistant to create a database using graphical steps. Launched by: Start > Programs > Oracle-OraHome90 > Configuration and Migration Tools. –Appendix A provides a step by step guide for creating a database manually on a UNIX system. Review the steps, and optionally create a database manually or by using the Database Configuration Assistant.


Download ppt "4 Copyright © Oracle Corporation, 2001. All rights reserved. 数据库创建."

Similar presentations


Ads by Google