SELECT tablespace_name, file_id, file_name, round(bytes / (1024 * 1024), 2) total_space
FROM dba_data_files ORDER BY tablespace_name;
SELECT a.segment_name, b.table_name, sum(a.bytes)/ 1024 / 1024 AS mb
FROM dba_segments a LEFT JOIN dba_lobs b ON a.segment_name = b.segment_name
WHERE a.tablespace_name = 'DSPACE' GROUP BY a.segment_name, b.table_name ORDER BY mb DESC;
select username, default_tablespace from dba_users;
select * from all_users
select * from user_users
create tablespace DSPACE datafile '/u01/app/oracle/oradata/EE/DNAME.dbf' size 500M autoextend on next 50M maxsize unlimited;
create tablespace DSPACE datafile 'c:\oracle\oradata\test\DNAME.dbf' size 500M autoextend on next 50M maxsize unlimited;
drop tablespace DSPACE including contents and datafiles cascade constraint;
alter tablespace DSPACE add datafile '/u01/app/oracle/oradata/EE/DNAME02.dbf' size 1000M autoextend on next 50M Maxsize UNLIMITED
create user DNAME identified by DPWD default tablespace DSPACE;
alter user DNAME identified by DPWD
alter user DNAME default tablespace DSPACE;
drop user DNAME cascade;
grant connect, resource to DNAME;
grant dba to DNAME;
grant select, update, delete, insert on dbName.TableName to DNAME
revoke dba from DNAME
select * from dba_role_privs where grantee='DNAME'
alter user DNAME account lock
alter user DNAME account unlock
select username,account_status,expiry_date,profile from dba_users
alter profile default limit password_life_time unlimited
alter profile default limit password_life_time 180
alter user DNAME identified by NewPwd
archive log list;
shutdown immediate;
startup mount;
alter system set log_archive_dest_1='location=/home/archive';
alter database archivelog;
alter database noarchivelog;
alter database open;
alter system switch logfile;
show parameter audit;
alter system set audit_trail=db_extended scope=spfile;
alter system set audit_trail=none scope=spfile;
audit all by {user};
shutdown immediate;
startup;