oracle環境配置與使用指南

    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

相關文章
相關標籤/搜索