Chinaunix首页 | 论坛 | 博客
  • 博客访问: 250881
  • 博文数量: 35
  • 博客积分: 198
  • 博客等级: 入伍新兵
  • 技术积分: 443
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-28 10:30
文章分类

全部博文(35)

文章存档

2015年(5)

2014年(14)

2013年(8)

2012年(7)

2011年(1)

我的朋友

分类: 数据库开发技术

2013-04-28 23:19:58

Step 1: Specify an Instance Identifier (SID)

Decide on a unique Oracle system identifier (SID) for your instance, open a command window, and set the ORACLE_SID environment variable. Use this command windows for the subsequent steps.

ORACLE_SID is used to distinguish this instance from other Oracle Database instances that you may create later and run concurrently on the same host computer. The maximum number of characters for ORACLE_SID is 12, and only letters and numeric digits are permitted. On some platforms, the SID is case-sensitive.
第一步,指定一个oracle系统标识ID(SID),ORACLE_SID环境变量用来唯一区别同一台主机上不同的oracle实例。 ORACLE_SID 最大12个字符长度,由字母和数字组成,不同的平台可能区分大小写。

Note:

It is common practice to set the SID to be equal to the database name. The maximum number of characters for the database name is eight. For more information, see the discussion of the DB_NAME initialization parameter in Oracle Database Reference.
备注: 通常情况下SID和数据库名db_name一样,因此,SID长度最大为8个字符。具体情况和平台有关系。

The following example for UNIX and Linux operating systems sets the SID for the instance that you will connect to in Step 6: Connect to the Instance:

  • Bourne, Bash, or Korn shell:

    ORACLE_SID=mynewdb
    export ORACLE_SID
    
  • C shell:

    setenv ORACLE_SID mynewdb
    

The following example sets the SID for the Windows operating system:

set ORACLE_SID=mynewdb
在unix和linux 系统上,设置SID 方法是,B shell K shell上执行 export ORACLE_SID=mynewdb , C shell 上是 setenv ORACLE_SID mynewdb

Step 2: Ensure That the Required Environment Variables Are Set
设定要求的环境变量值。
For example, on most platforms, ORACLE_SID and ORACLE_HOME must be set. In addition, it is advisable to set the PATH variable to include the ORACLE_HOME/bin directory. On the UNIX and Linux platforms, you must set these environment variables manually. On the Windows platform, OUI automatically assigns values toORACLE_HOME and ORACLE_SID in the Windows registry. If you did not create a database upon installation, OUI does not set ORACLE_SID in the registry, and you will have to set the ORACLE_SID environment variable when you create your database later.

大多数平台上,要求环境变量ORACLE_HOME ORACLE_SID必须设置,并且ORACLE_HOME/bin目录必须加到PATH路径下。在unix和linux 平台这些变量必须设置,在windows平台不用设置,OUI(没理解错应该是
Oracle universal Installer),自动为ORACLE_HOME,ORACLE_SID分配值注册到系统,如果你不是用oui创建oracle 数据库,那么ORACLE_SID不会被设置,你需要手动设置ORACLE_SID变量。

Step 3: Choose a Database Administrator Authentication Method

You must be authenticated and granted appropriate system privileges in order to create a database. You can authenticate as an administrator with the required privileges in the following ways:

  • With a password file

  • With operating system authentication

In this step, you decide on an authentication method.

If you decide to authenticate with a password file, create the password file as described in "Creating and Maintaining a Password File". If you decide to authenticate with operating system authentication, ensure that you log in to the host computer with a user account that is a member of the appropriate operating system user group. On the UNIX and Linux platforms, for example, this is typically the dba user group. On the Windows platform, the user installing the Oracle software is automatically placed in the required user group.

第三步,选择ORACLE管理认证方式。
为了安装数据库,必须验证和授予管理员一定的权限。你可以通过2种方式鉴权。第一种使用密码文件方式鉴权,第二种使用操作系统鉴权。如果使用密码文件(只是扩展,蓝色为扩展内容),orapwd 命令创建sys用户密码,用法为
Usage: orapwd file= password= entries= force= 
如果使用操作系统鉴权,你必须使用归属于适当组用户口令登录系统,在unix和Linux平台,一般使用dba用户组下的用户。在Windows平台,安装oracle软件的用户被默认为通过鉴权用户。

Step 4: Create the Initialization Parameter File

When an Oracle instance starts, it reads an initialization parameter file. This file can be a text file, which can be created and modified with a text editor, or a binary file, which is created and dynamically modified by the database. The binary file, which is preferred, is called a server parameter file. In this step, you create a text initialization parameter file. In a later step, you create a server parameter file from the text file.

One way to create the text initialization parameter file is to edit the sample presented in "Sample Initialization Parameter File".

For convenience, store your initialization parameter file in the Oracle Database default location, using the default file name. Then when you start your database, it will not be necessary to specify the PFILE clause of the STARTUP command, because Oracle Database automatically looks in the default location for the initialization parameter file.

For more information about initialization parameters and the initialization parameter file, including the default name and location of the initialization parameter file for your platform, see "About Initialization Parameters and Initialization Parameter Files".

第四步,创建oracle初始化参数文件。
当数据库实例启动时,它去读初始化参数文件,这个文件可以是一个文本文件,可以使用文本编辑器修改,也可以是一个二进制文件,它自动被oracle创建和修改,二进制文件是oracle server优先加载的文件,下面告诉你如何通过文本方式创建初始化参数文件,一个server 参数文件是由这个文本文件创建。
为管理方便,初始化参数文件被放在本地默认目录,使用默认的名字。当你启动数据库,不用指定由startup启动指定的pfile参数。因为oracle数据库自动查找默认位置下的参数文件。
题外话: 创建spfile文件方法,以oracle 用户 执行 sqlplus "/as sysdba"  先shutdown abort  数据库实例,然后执行 如下命令:
create  spfile  from  pfile='?/dbs/initsid.ora';

Step 5: (Windows Only) Create an Instance

On the Windows platform, before you can connect to an instance, you must manually create it if it does not already exist. The ORADIM command creates an Oracle instance by creating a new Windows service.

To create an instance:

  • Enter the following command at a Windows command prompt:

    oradim -NEW -SID sid -STARTMODE MANUAL -PFILE pfile 

    where sid is the desired SID (for example mynewdb) and pfile is the full path to the text initialization parameter file. This command creates the instance but does not start it.

Warning:

Do not set the -STARTMODE argument to AUTO at this point, because this causes the new instance to start and attempt to mount the database, which does not exist yet. You can change this parameter to AUTO, if desired, in Step 14.

See the section "Using ORADIM to Administer an Oracle Database Instance" in Oracle Database Platform Guide for Microsoft Windows for more information on the ORADIM command.

第五步,创建oracle实例(只Windows平台)
在Windows平台上,在你连接数据库实例之前,如果oracle实例不存在,必须先创建oracle实例,oradim 命令创建一个实例,输入如下命令执行创建oracle实例
oradim -NEW -SID sid -STARTMODE MANUAL -PFILE pfile 
pfile 文件为绝对路径的初始化文件名。命令只启动实例,不启动数据库。

由于水平有限,属于自我学习的整理资料,这篇先翻译到这,明天再学习学习。
翻译oracle文档地址:

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