1. plsql:
sqlplus /nolog
(Linux:su - oracle)
2. Connect database:
Connect to the local database: conn / as sysdba
remotely connect to the database: conn username / password @ IP address: port / orcl;
3. Query the current database name, service name, instance name, table space, user name:
Database: select name from V $ database;
Service Name: show parameter service_names;
instance name: select instance_name from V $ instance;
Table space: select default_tablespace from dba_users where username = ' logged-on user' (user name capitalized)
Username: select * from user_users;
4. User Management
Create a user: create user ukey identified by aisino;
to give permission:
Grant Connect, Resource, dba to UKey;
Grant the Create the session to UKey;
all tables in a query to the user:
the SELECT * from all_tables the WHERE owner = 'logged-on user' (user name capitalized)
the SELECT table_name from USER_TABLES;
modify the user's default table space: alter user dbcenter default tablespace DBCENTER_DATA
5. Create a new tablespace:
create tablespace user_temp
tempfile 'D:\oracle\oradata\Oracle9i\user_temp.dbf'
size 50m
autoextend on
next 50m maxsize 20480m;
6. Exit oracle:
quit