oracle怎么创建数据库实例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle怎么创建数据库实例相关的知识,希望对你有一定的参考价值。

参考技术A   oracle手动创建数据库步骤如下所示:
  1.编写初始化参数文件
  2.设置操作系统环境变量
  3.创建实例
  4.以管理员身份连接数据库
  5.启动实例
  6.create
database
创建数据库
  7.运行数据字典脚本
  8.Oracle的网络配置
(客户端连接到服务端)
  初始化参数文件
  从%ORACLE_HOME%\admin\sample\pfile从复制initsmpl.ora文件,并黏贴到$ORACLE_HOME%\database目录下,改名为init<sid>假设改为initzhouyt.ora.(init为文本文件)
  对initzhouyt.ora内容进行修改
  新增参数
  *
instance_name=zhouyt
  *
db_domain=hdu.edu.cn
  修改参数
  *
db_name=zhouyt
  *
db_block_size=8192(8kM)
  *
remote_login_passwordfile=exclusive
  操作系统环境变量
  设置操作系统环境变量oracle_sid指向数据库实例的名称
  set
oracle_sid=zhouyt
  该命令在window
dos窗口下只对当前有效,当关闭窗口则失效,想要一直有效,则需要在系统环境变量中修改
  创建实例
  实用工具oradim使用
  在DOS窗口输入命令
oradim
-new
-sid
zhouyt
-intpwd
sys123(sys的密码,sys是管理员)
-startmode
auto
  sid是Oracle在操作系统中的“身份证号码”
  管理员身份连接数据库
  sqlplus实用工具登录数据库
  在DOS命令输入sqlplus/nolog
只是登录状态
  以数据库管理员身份连接数据库
  在上面的基础上输入命令
connect
sys/sys123
as
sysdba
  因为以
数据库管理员身份
登录可以
安装数据库
  启动实例
  将文本初始化参数文件pfile转化为二进制初始化参数文件spfile
  因为数据库启动需要找到配置文件,默认寻找二进制文件,也可以手动启动文本文件,那这一步就不需要了
  输入命令
create
spfile
from
pfile;
(将会报错,因为文本文件比较老相对于Oracle
10g),
这个时候我们需要修改配置文件initzhouyt.ora
  这个时候在%ORACLE_HOME%\database文件下会生成SPFILEZHOUYT.ora文件
  以nomount形式启动实例
  命令
startup
nomount,将会出现错误,当我们按照提示修改文本文件以后,如果我们还是按照startup
nomount来启动的话,我们要生成相应的二进制文件来覆盖旧的二进制文件
  并注释%seed_control%
  create
databae
创建数据库
  创建数据库脚本
  三个文件
  控制文件
  数据文件
  重做日志文件
  create
database
zhouyt
  datafile
  'C:\oracle\product\10.2.0\db_2\zhouyt\system_01.dbf'
size
100m
  Autoextend
on
next
10m
maxsize
unlimited
  sysaux
datafile
  'C:\oracle\product\10.2.0\db_2\zhouyt\systemaux_01.dbf'
size
60m
  Autoextend
on
next
10m
maxsize
unlimited
  logfile
  group
1
('C:\oracle\product\10.2.0\db_2\zhouyt\log_1_01.rdo')
size
10m,
  group
2
('C:\oracle\product\10.2.0\db_2\zhouyt\log_2_01.rdo')
size
10m
  character
set
zhs16gbk;
  需要确保目录文件"db_2\zhouyt"存在
  生成两个数据文件和两个重做日志文件,那么控制文件呢?
  运行数据字典脚本
  __数据库创建后,系统会生成两个管理员用户sys和system
  运行3个数据字典脚本
  catalog.sql
创建系统常用的数据字典视图和同义词
(sys登录);
  catproc.sql
建立PL/SQL功能的使用环境,还创建几个PL/SQL包用于扩展RDBMS功能
(sys登录);
  pupbld.sql
使用SQL*PLUS环境时需要
(system登录)
  在命令行输入@
加脚本文件的绝对路径
  第二个脚本过程和第一个一样
  执行第三个脚本需要切换到system用户
  connect
system/manager
  @
C:\oracle\product\10.2.0\db_2\sqlplus\admin\pupbld.sql
  创建scott模式
  @
C:\oracle\product\10.2.0\db_2\RDBMS\ADMIN\scott.sql

我的Oracle怎么创建不了触发器

我的Oracle怎么创建不了触发器

参考技术A SQL> select * from dba_sys_privs where grantee='SYS';

GRANTEE PRIVILEGE ADMIN_OPTION
------------------------------ ---------------------------------------- ------------
SYS UPDATE ANY CUBE BUILD PROCESS NO
SYS CREATE MINING MODEL NO
SYS DROP ANY ASSEMBLY NO
SYS DROP ANY EDITION NO
SYS CREATE EXTERNAL JOB NO
SYS MANAGE FILE GROUP NO
SYS ADMINISTER SQL TUNING SET NO
SYS MANAGE SCHEDULER NO
SYS CREATE ANY RULE YES
SYS CREATE ANY EVALUATION CONTEXT YES
SYS CREATE ANY CONTEXT NO
SYS MANAGE ANY QUEUE YES
SYS ALTER ANY INDEXTYPE NO
SYS CREATE ANY MATERIALIZED VIEW NO
SYS EXECUTE ANY PROCEDURE NO
SYS ALTER ANY ROLE NO
SYS GRANT ANY ROLE NO
SYS DROP PUBLIC DATABASE LINK NO
SYS CREATE DATABASE LINK NO
SYS CREATE ANY INDEX NO

GRANTEE PRIVILEGE ADMIN_OPTION
------------------------------ ---------------------------------------- ------------
SYS ALTER ANY CLUSTER NO
SYS ALTER ROLLBACK SEGMENT NO
SYS ALTER SESSION NO
SYS AUDIT SYSTEM NO
SYS ADMINISTER SQL MANAGEMENT OBJECT NO
SYS DROP ANY MEASURE FOLDER NO
SYS CREATE ANY CUBE NO
SYS COMMENT ANY MINING MODEL NO
SYS DROP ANY MINING MODEL NO
SYS DROP ANY SQL PROFILE NO
SYS ALTER ANY RULE YES
SYS IMPORT FULL DATABASE NO
SYS CREATE RULE SET YES
SYS EXECUTE ANY EVALUATION CONTEXT YES
SYS FLASHBACK ANY TABLE NO
SYS CREATE ANY DIMENSION NO
SYS EXECUTE ANY INDEXTYPE NO
SYS DROP ANY INDEXTYPE NO
SYS CREATE ANY INDEXTYPE NO
SYS CREATE ANY OPERATOR NO
SYS CREATE LIBRARY NO

GRANTEE PRIVILEGE ADMIN_OPTION
------------------------------ ---------------------------------------- ------------
SYS CREATE ANY DIRECTORY NO
SYS CREATE PROFILE NO
SYS CREATE VIEW NO
SYS INSERT ANY TABLE NO
SYS SELECT ANY TABLE YES
SYS LOCK ANY TABLE NO
SYS DROP ANY TABLE NO
SYS CREATE CUBE NO
SYS INSERT ANY CUBE DIMENSION NO
SYS DROP ANY CUBE DIMENSION NO
SYS ALTER ANY CUBE DIMENSION NO
SYS MANAGE ANY FILE GROUP NO
SYS CREATE ANY SQL PROFILE NO
SYS EXECUTE ANY CLASS NO
SYS CREATE ANY JOB NO
SYS ADVISOR NO
SYS EXPORT FULL DATABASE NO
SYS RESUMABLE NO
SYS DROP ANY OUTLINE NO
SYS DROP ANY DIMENSION NO
SYS UNDER ANY TABLE NO

GRANTEE PRIVILEGE ADMIN_OPTION
------------------------------ ---------------------------------------- ------------
SYS EXECUTE ANY LIBRARY NO
SYS DROP ANY LIBRARY NO
SYS CREATE ANY LIBRARY NO
SYS ALTER ANY TYPE NO
SYS DROP ANY ROLE NO
SYS CREATE ROLE NO
SYS DROP ANY SEQUENCE NO
SYS ALTER ANY SEQUENCE NO
SYS CREATE SEQUENCE NO
SYS CREATE PUBLIC SYNONYM NO
SYS UPDATE ANY TABLE NO
SYS CREATE ROLLBACK SEGMENT NO
SYS UNLIMITED TABLESPACE NO
SYS CREATE TABLESPACE NO
SYS CREATE ANY CUBE BUILD PROCESS NO
SYS DELETE ANY MEASURE FOLDER NO
SYS CREATE MEASURE FOLDER NO
SYS CREATE ANY CUBE DIMENSION NO
SYS ALTER ANY MINING MODEL NO
SYS EXECUTE ANY ASSEMBLY NO
SYS ALTER ANY ASSEMBLY NO

GRANTEE PRIVILEGE ADMIN_OPTION
------------------------------ ---------------------------------------- ------------
SYS CREATE ASSEMBLY NO
SYS CHANGE NOTIFICATION NO
SYS ADMINISTER ANY SQL TUNING SET NO
SYS DROP ANY RULE SET YES
SYS DEBUG ANY PROCEDURE NO
SYS ENQUEUE ANY QUEUE YES
SYS EXECUTE ANY TYPE NO
SYS CREATE ANY TRIGGER NO
SYS CREATE ANY PROCEDURE NO
SYS ALTER DATABASE NO
SYS DROP ANY VIEW NO
SYS CREATE ANY VIEW NO
SYS CREATE SYNONYM NO
SYS DROP ROLLBACK SEGMENT NO
SYS DROP USER NO
SYS CREATE USER NO
SYS FLASHBACK ARCHIVE ADMINISTER NO
SYS DROP ANY CUBE BUILD PROCESS NO
SYS UPDATE ANY CUBE NO
SYS SELECT ANY CUBE NO
SYS SELECT ANY CUBE DIMENSION NO

GRANTEE PRIVILEGE ADMIN_OPTION
------------------------------ ---------------------------------------- ------------
SYS DELETE ANY CUBE DIMENSION NO
SYS CREATE CUBE DIMENSION NO
SYS ALTER ANY EDITION NO
SYS ALTER ANY SQL PROFILE NO
SYS CREATE RULE YES
SYS ALTER ANY EVALUATION CONTEXT YES
SYS CREATE EVALUATION CONTEXT YES
SYS ON COMMIT REFRESH NO
SYS MERGE ANY VIEW NO
SYS CREATE ANY OUTLINE NO
SYS DROP ANY CONTEXT NO
SYS GLOBAL QUERY REWRITE NO
SYS QUERY REWRITE NO
SYS UNDER ANY VIEW NO
SYS CREATE INDEXTYPE NO
SYS CREATE ANY TYPE NO
SYS CREATE TYPE NO
SYS DROP ANY DIRECTORY NO
SYS DROP ANY MATERIALIZED VIEW NO
SYS ANALYZE ANY NO
SYS ALTER PROFILE NO

GRANTEE PRIVILEGE ADMIN_OPTION
------------------------------ ---------------------------------------- ------------
SYS FORCE ANY TRANSACTION NO
SYS AUDIT ANY NO
SYS DROP ANY INDEX NO
SYS CREATE ANY CLUSTER NO
SYS ALTER ANY TABLE NO
SYS CREATE SESSION NO
SYS ALTER SYSTEM NO
SYS CREATE ANY MEASURE FOLDER NO
SYS ALTER ANY CUBE NO
SYS SELECT ANY MINING MODEL NO
SYS CREATE ANY MINING MODEL NO
SYS CREATE JOB NO
SYS EXECUTE ANY RULE YES
SYS DROP ANY EVALUATION CONTEXT YES
SYS GRANT ANY OBJECT PRIVILEGE NO
SYS ALTER ANY OUTLINE NO
SYS ALTER ANY LIBRARY NO
SYS DROP ANY TYPE NO
SYS GRANT ANY PRIVILEGE NO
SYS ALTER RESOURCE COST NO
SYS ALTER ANY TRIGGER NO

GRANTEE PRIVILEGE ADMIN_OPTION
------------------------------ ---------------------------------------- ------------
SYS CREATE TRIGGER NO
SYS FORCE TRANSACTION NO
SYS DROP ANY CLUSTER NO
SYS CREATE CLUSTER NO
SYS COMMENT ANY TABLE NO
SYS CREATE ANY TABLE NO
SYS RESTRICTED SESSION NO
SYS UPDATE ANY CUBE DIMENSION NO
SYS CREATE CUBE BUILD PROCESS NO
SYS CREATE ANY ASSEMBLY NO
SYS SELECT ANY TRANSACTION NO
SYS EXECUTE ANY PROGRAM NO
SYS EXECUTE ANY RULE SET YES
SYS ALTER ANY RULE SET YES
SYS DEQUEUE ANY QUEUE YES
SYS ALTER ANY DIMENSION NO
SYS DROP ANY OPERATOR NO
SYS ALTER ANY OPERATOR NO
SYS CREATE MATERIALIZED VIEW NO
SYS ALTER ANY PROCEDURE NO
SYS CREATE PROCEDURE NO

GRANTEE PRIVILEGE ADMIN_OPTION
------------------------------ ---------------------------------------- ------------
SYS CREATE ANY SEQUENCE NO
SYS DROP PUBLIC SYNONYM NO
SYS ALTER ANY INDEX NO
SYS DELETE ANY TABLE NO
SYS CREATE TABLE NO
SYS ALTER USER NO
SYS BECOME USER NO
SYS DROP TABLESPACE NO
SYS ALTER TABLESPACE NO
SYS INSERT ANY MEASURE FOLDER NO
SYS DROP ANY CUBE NO
SYS EXECUTE ASSEMBLY NO
SYS CREATE ANY EDITION NO
SYS READ ANY FILE GROUP NO
SYS DROP ANY RULE YES
SYS CREATE ANY RULE SET YES
SYS DEBUG CONNECT SESSION NO
SYS ADMINISTER DATABASE TRIGGER NO
SYS ADMINISTER RESOURCE MANAGER NO
SYS CREATE DIMENSION NO
SYS EXECUTE ANY OPERATOR NO

GRANTEE PRIVILEGE ADMIN_OPTION
------------------------------ ---------------------------------------- ------------
SYS CREATE OPERATOR NO
SYS UNDER ANY TYPE NO
SYS ALTER ANY MATERIALIZED VIEW NO
SYS DROP PROFILE NO
SYS DROP ANY TRIGGER NO
SYS DROP ANY PROCEDURE NO
SYS CREATE PUBLIC DATABASE LINK NO
SYS SELECT ANY SEQUENCE NO
SYS DROP ANY SYNONYM NO
SYS CREATE ANY SYNONYM NO
SYS BACKUP ANY TABLE NO
SYS MANAGE TABLESPACE NO

你把 SYS 换成你自己的用户名 查查看
参考技术B 是不是权限的问题
用管理员试试可以不可以以创建本回答被提问者采纳
参考技术C Oracle 报什么错误?
是没有创建触发器的权限?
还是指定名字的触发器已经存在了?
还是语法错得太离谱?
参考技术D 你是否具有权限,最好说的具体一点

以上是关于oracle怎么创建数据库实例的主要内容,如果未能解决你的问题,请参考以下文章

linux下怎么创建oracle实例

怎么在linux上面创建第二个实例

怎么用 PLSQL Developer 创建新的oracle数据库

Oracle数据库怎么添加新的实例

linux oracle 怎么创建新的数据库

oracle数据库怎么创建数据库实例