1、oracle安装
sql
首先说oracle service,我使用的是oracle 11g,直接官网下载的版本,下载下来是:win64_11gR2_database_1of2.zip、win64_11gR2_database_2of2.zip两个解压包,注意的是要把两个包里的东西合并之后再setup.exe。数据库
不少时候,咱们并不须要安装service,咱们只是须要一个客户端,那么咱们能够用instantclient,而后安装PL/SQL来界面管理。由于PL/SQL只有32位的,64位的instantclient并不能与其成功链接,因此若是安装instantclient的时候也是要安装32位的。
session
值得注意的是service端与instantclient并不能并存(其实安装了service就有了client),我起初就是配置了instantclient,后来要安装service,由于没有把instantclient的配置删干净一直安装报错。
oracle
2、建立存储空间
ide
service启动之后咱们要用数据库就得建立存储空间,咱们首先用system(DBA权限)登陆PL/SQL,而后打开一个command window,而后执行以下语句:
spa
CREATE TABLESPACE "ST_DATA" LOGGING DATAFILE '+ FILEPATH/st_data.ora' SIZE 1000M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO; CREATE TEMPORARY TABLESPACE "ST_TEMP" TEMPFILE '+FILEPATH/st_temp.ora' SIZE 1000M AUTOEXTEND ON NEXT 10M MAXSIZE 4096M EXTENT MANAGEMENT LOCAL;
以上就建立了两个存储空间,一个用来存数据,之后用来存temp。平时咱们并不会用DBA权限的数据库角色来直接管理数据库中的业务数据,因此咱们要建立用户并赋予权限来管理:debug
create user st identified by st default tablespace ST_DATA temporary tablespace ST_TEMP; grant connect to st; grant resource to st; grant debug any procedure to st; grant debug connect session to st; grant create database link to st; grant create procedure to st; grant create table to st; grant create trigger to st; grant create any index to st; grant create any sequence to st; grant create any view to st; grant create any synonym to st; grant create any job to st; grant unlimited tablespace to st; grant select on dba_data_files to st; grant select on dba_free_space to st;
以上,咱们建立好了角色,那么咱们能够用st角色,密码st的用户来登陆PL/SQL来管理业务数据了!
ip