1. Create a table space
Instructions for exporting Oracle data:ExpJDs/JDs@192.168.99.199/Orclfile=C:\JDS.DMP owner=JDS Instructions for importing Oracle data: Imp ZCL/Zcl@127.0.0.1:1521/Orclfile=C:\jds.dmp Full=y--1th Step: Create a temporary table spaceCREATE TemporaryTablespace user_temp Tempfile'E:\OrclData\DataTemp\User_Temp.dbf'SIZE 50m Autoextend on NEXT50m MAXSIZE 20480m EXTENT MANAGEMENT LOCAL;--2nd step: Create a tablespace statement (create tablespace name: user_data; Create location: E:\OrclData\DataSpace\User_Data.dbf Initial Size: 50m; auto-grow by 50M size, Max 20480M)CREATETablespace user_data datafile'E:\OrclData\DataSpace\User_Data.dbf'SIZE 50m Autoextend on NEXT50m MAXSIZE 20480m EXTENT MANAGEMENT LOCAL;--3rd Step: Create a user in the Tablespace (create username and password user name: zcl password: zcl; default tablespace location: User_data)CREATE USERZCL identified byZclDEFAULTTablespace User_dataTemporarytablespace user_temp;--4th step: Grant the user permissions (give the user ZCL permissions: Connection permissions, modify permissions, maximum permissions)GRANTConnect,resource,dba toZcl
2. Create a user, table space, and set permissions
//DBA Account Login Sqlplus Please enter your username: Dpp_data asSYSDBA Please enter password: dpp_data//Create an accountCreate UserTechrpt_data identified byTechrpt_data;//Create a temporary table spaceCreate Temporarytablespace techrpt_data_temptempfile'D:\ORACLE\ORADATA\ORCL\TECHRPT_DATA_TEMP.dbf'size 32mautoextend onNext32m maxsize 2048mextent management local;//Assigning a temporary tablespace to a userAlter UserTechrpt_dataTemporarytablespace techrpt_data_temp;//CREATE TABLE SpaceCreatetablespace techrpt_data Logging datafile'D:\ORACLE\ORADATA\ORCL\TECHRPT_DATA.ora'size 50m Autoextend on Next50m maxsize 2048m extent management local;//To assign a tablespace to a userAlter UserTechrpt_datadefaulttablespace techrpt_data;//AuthorizedGrantDba toTechrpt_data;GrantConnect,resource toTechrpt_data;Grant CreateSession toTechrpt_data;Grant Create anySequence toTechrpt_data;Grant Create any Table toTechrpt_data;Grant Delete any Table toTechrpt_data;Grant Insert any Table toTechrpt_data;Grant Select any Table toTechrpt_data;Grant Update any Table toTechrpt_data;GrantUnlimited tablespace toTechrpt_data;Grant Execute any procedure toTechrpt_data;Grant Create any View toTechrpt_data;Grant Select onV_$statname toTechrpt_data;Grant Select onV_$sesstat toTechrpt_data;Grant Select onV_$session toTechrpt_data;Grant Select onV_$mystat toTechrpt_data;//SubmitCommit;//quit quit;//Delete UserDrop UserTechrpt_dataCascade;//Delete Table SpaceDropTablespace Techrpt_data including contents anddatafiles;//Change PasswordAlter UserSystem identified bySystem
Oracle creates table spaces