[SQL]View PlainCopy
- To establish the tablespace and the user's steps:
- User
- Create:Create user username identified by "password";
- Authorization:Grant create session to user name;
- Grant create table to user name;
- Grant create tablespace to user name;
- Grant Create view to user name;
[SQL]View PlainCopy
- Table Space
- Create a tablespace (typically a table space with n stored data and an index space):
- Create tablespace table space name
- DataFile ' Path (to build the path first) \***.dbf ' size *m
- Tempfile ' path \***.dbf ' size *m
- Autoextend on -automatic growth
- --There are some commands to define the size, see the need
- Default Storage (
- Initial 100K,
- Next 100k,
- );
[SQL]View PlainCopy
- Example: creating a table space
- Create Tablespace Demospace
- DataFile ' e:/oracle_tablespaces/demospace_tbspace.dbf '
- Size 1500M
- Autoextend on next 5M maxsize 3000M;
- Delete Table space
- Drop tablespace demospace including contents and datafiles
[SQL]View PlainCopy
- User Rights
- To grant a user permission to use the tablespace:
- Alter user username quota Unlimited on table space;
- or alter user username quota *m on table space;
Complete Example:
[SQL]View PlainCopy
- --Table space
- CREATE tablespace SDT
- DataFile ' F:\tablespace\demo ' size 800M
- EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
- --Index Table space
- CREATE tablespace Sdt_index
- DataFile ' F:\tablespace\demo ' size 512M
- EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
- --2. Build Users
- Create User demo identified by demo
- Default Tablespace demo;
- --3. Empowering
- Grant Connect,resource to demo;
- Grant create any sequence to demo;
- Grant create any table to demo;
- Grant Delete any table to demo;
- Grant insert any table to demo;
- Grant select any table to demo;
- Grant Unlimited tablespace to demo;
- Grant execute any procedure to demo;
- Grant update any table to demo;
- Grant Create any view to demo;
[SQL]View PlainCopy
- --Import and export commands
- IP Export mode: Exp demo/[email protected]:1521/orcl file=f:/f.dmp full=y
- Exp Demo/[email protected] file=f:/f.dmp full=y
- Imp demo/[email protected] file=f:/f.dmp full=y ignore=y
Oracle establishes tablespaces and users