Informix Show Locks
Informix Show Locks
(informix)
(Oracle) Log out of sqlplus and back in before running the dropviews.sql, and be
sure to change the date to something close to current.
update sy_scl_def
set last_update = current
where sc_type like 'W%';
update sy_tran_cd
set last_update = current
where type = '4L'
or type = '4P' or type = '4U';
(Oracle)
update sy_scl_def
set last_update = sysdate
where sc_type like 'W%';
update sy_tran_cd
set last_update = sysdate
where type = '4L' or type = '4P' or type = '4U';
Condensing extents
(Informix)
Page
2
This will rebuild the table in the process, so it is also a handy way to re-create
extents (you can just specifying the existing dbspace name to re-create the table in
the same space).
select dbsname,
tabname,
count(*) num_of_extents,
sum( pe_size ) total_size
from systabnames, sysptnext
where partnum = pe_partnum
and tabname not matches "sys*"
and tabname not matches "TBL*"
group by 1, 2
having count(*) >= 8
order by 3 desc, 4 desc;
Page
3
Delete data from a table using a single lock
(Informix)
When needing to delete large amount of data from tables you can use this to limit
locks and speed up the process
BEGIN WORK;
LOCK TABLE <tabname> IN EXCLUSIVE MODE;
DELETE FROM <tabname> WHERE 1=1;
COMMIT WORK;
Note: If using the Enterprise edition of Oracle, the keyword “online” can be specified
after “rebuild” to rebuild the indexes with no downtime (ie exclusive access is not
required).
Indexes:
Page
4
where table_owner = 'OPS$BSIDBA';
spool off
Statistics:
As long as every file has a Status of ‘ACTIVE’, you can now backup all .dbf files.
Run the alter statements for every tablespace specifying “end backup”:
Page
5
alter tablespace temp end backup;
alter tablespace users end backup;
alter tablespace ifas end backup;
This shows the amount of free space in each datafile, and whether each datafile is
set to auto extend or not.
select
a.file_id
,a.tablespace_name
,trunc(decode(a.autoextensible,'YES',a.maxsize-
a.bytes+b.free,'NO',b.free)/1024/1024) free_mb
,trunc(a.bytes/1024/1024) size_mb
,trunc(a.maxsize/1024/1024) maxsize_mb
,a.autoextensible ae
,trunc(decode(a.autoextensible,'YES',(a.maxsize-a.bytes+b.free)/a.maxsize*100,
'NO',b.free/a.maxsize*100)) free_pct
from
(select
file_id
,tablespace_name
,autoextensible
,bytes
,decode(autoextensible,'YES',maxbytes,bytes) maxsize
from dba_data_files
group by file_id, tablespace_name, autoextensible, bytes,
decode(autoextensible,'YES',maxbytes,bytes)) a,
(select file_id, tablespace_name, sum(bytes) free
from dba_free_space
group by file_id, tablespace_name) b
where a.file_id=b.file_id(+)
and a.tablespace_name=b.tablespace_name(+)
order by a.tablespace_name asc;
Page
6