Tuesday, January 24, 2012

How to extend Tablespace size in Oracle?

To see the size of the Tablespace:

select
file_name,
autoextensible,
(bytes/1024)/1024 usedmb,
(maxbytes/1024)/1024 maxmb,
round((((bytes/1024)/1024)
/ ((maxbytes/1024)/1024)) * 100) used_pct
from dba_data_files
where 1=1
and tablespace_name = 'TEST'
;

To increase the size of the existed datafile:
ALTER DATABASE
DATAFILE ‘/u01/oradata/ datafile01. dbf’
RESIZE 500M;

To add a new datafile to a tablespace use following query:

ALTER TABLESPACE TEST ADD DATAFILE ‘/u01/oradata/ datafile02. dbf’ SIZE 500M;

Wednesday, January 18, 2012

How to disable Oracle's password expiry?


 In the  Oracle 11g sets password expiry by default. To get rid of it, do the following...

Execute the following command as SYS or SYSTEM

ALTER PROFILE DEFAULT LIMIT
  FAILED_LOGIN_ATTEMPTS UNLIMITED
  PASSWORD_LIFE_TIME UNLIMITED;

Tuesday, January 17, 2012

Oracle: How to Change Datafile Size

Connect as SYSTEM or SYS and execute the following commands.

ALTER DATABASE DATAFILE '/datafilename.dbf'  RESIZE 100M;
Example: Temp tablespace:

To see the used and freespace of the table space:

select TABLESPACE_NAME, BYTES_USED, BYTES_FREE from V$TEMP_SPACE_HEADER;

Change the tablespace size:
alter database tempfile 'D:\oracle\bise1\oradata\bise1db\TEMP01.DBF' resize 300M;

Cheers :)