利用toad发现oracle自动为你干了什么(表空间建立和用户建立)
Oracle:10.2.0.1
Windows 2003
一、表空间
sql>Create tablespace dba datafile ‘D:\dba.dbf’ size 1M autoextend on maxsize 10M;
-- DBA (Tablespace)
--
CREATE TABLESPACE DBA DATAFILE
'D:\DBA.DBF' SIZE 1M AUTOEXTEND ON NEXT 8K MAXSIZE 10M
LOGGING
ONLINE
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
BLOCKSIZE 8K
SEGMENT SPACE MANAGEMENT AUTO
FLASHBACK ON;
分析:
1、next 8k ,这个不是固定的,我们这里自动增长管理,会随着表空间的增加而增大,而且不能缩小。(正因为不能缩小,所以自动管理也存在性能问题,为什么?很简单自己想想)
2、logging ,创建表空间是否产生日志。
3、online ,创建完就是在线的。
4、extent management local autoallocate,本地管理自动分配。
5、blocksize 8k ,块大小
6、segment space management auto,段自动管理
7、flashback on ,开启表空间闪回
二、临时表空间
sql>Create temporary tablespace dba_temp tempfile ‘D:\dba_temp.dbf’ size 20M;
-- DBA_TEMP (Tablespace)
--
CREATE TEMPORARY TABLESPACE DBA_TEMP TEMPFILE
'D:\DBA_TEMP.DBF' SIZE 20M AUTOEXTEND OFF
TABLESPACE GROUP ''
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;
三、用户
sql>Create user doudou identified by doudou default tablespace dba temporary tablespace dba_temp;
-- DOUDOU (User)
--
CREATE USER DOUDOU
IDENTIFIED BY VALUES '2A99AC519423EAFD'
DEFAULT TABLESPACE DBA
TEMPORARY TABLESPACE DBA_TEMP
PROFILE DEFAULT
ACCOUNT UNLOCK;
从这里我们看出,我们建立的用户oracle会默认给我们指定 PROFILE DEFAULT属性,然后利用toad看看 profile default包含什么属性。
下面是介绍 PROFILE DEFAULT属性
-- "DEFAULT" (Profile)
--
CREATE PROFILE "DEFAULT" LIMIT
SESSIONS_PER_USER UNLIMITED
CPU_PER_SESSION UNLIMITED
CPU_PER_CALL UNLIMITED
CONNECT_TIME UNLIMITED
IDLE_TIME UNLIMITED
LOGICAL_READS_PER_SESSION UNLIMITED
LOGICAL_READS_PER_CALL UNLIMITED
COMPOSITE_LIMIT UNLIMITED
PRIVATE_SGA UNLIMITED
FAILED_LOGIN_ATTEMPTS 10 (用户登陆失败十次,oralce 会lock用户)
PASSWORD_LIFE_TIME UNLIMITED
PASSWORD_REUSE_TIME UNLIMITED
PASSWORD_REUSE_MAX UNLIMITED
PASSWORD_LOCK_TIME UNLIMITED
PASSWORD_GRACE_TIME UNLIMITED
PASSWORD_VERIFY_FUNCTION NULL;
还有另外一些属性
--
-- ADMIN_DIR (Directory)
--
CREATE OR REPLACE DIRECTORY
ADMIN_DIR AS
'C:\ADE\aime_10.2_nt_push\oracle/md/admin';
--
-- DATA_PUMP_DIR (Directory)
--
CREATE OR REPLACE DIRECTORY
DATA_PUMP_DIR AS
'F:\oracle\product\10.2.0\admin\test\dpdump\';
--
-- DUMP (Directory)
--
CREATE OR REPLACE DIRECTORY
DUMP AS
'E:\dump
';
--
-- WORK_DIR (Directory)
--
CREATE OR REPLACE DIRECTORY
WORK_DIR AS
'C:\ADE\aime_10.2_nt_push\oracle/work';
--
-- TEST (Directory)
--
CREATE OR REPLACE DIRECTORY
TEST AS
'F:\ORACLE\';
GRANT READ, WRITE ON DIRECTORY DUMP TO ABC;
GRANT READ, WRITE ON DIRECTORY DATA_PUMP_DIR TO EXP_FULL_DATABASE;
GRANT READ, WRITE ON DIRECTORY DATA_PUMP_DIR TO IMP_FULL_DATABASE;
GRANT READ, WRITE ON DIRECTORY DUMP TO SYSTEM;
GRANT READ, WRITE ON DIRECTORY TEST TO SYSTEM;