This is an old revision of the document!
Table of Contents
Database_Status
Check datafiles for their recovery status (compared with what is in the controlfile)
Depending on how the database was last shut down (or recovered), this will show if data files are to of sync with the control file.
0@@
How to stop and start a database on a Solaris Veritas cluster
Following a database crash...
Check the status of the datafiles and tablespaces. They might need recovering.<br /> Restarted and checked alert log. datafile 6 was in RECOVER status
3@@
How big is the database?
Calculate the total database size
4@@
How big are the tablespaces?
Report the database size in terms of tablespace
5@@
Database Free space report
From asktom
*Tablespace Name: name of tablespace, leading '*' indicates a good locally managed tablespace, leading blank means it is a bad dictionary managed tablespace. Second character of A implies ASSM managed storage, second character of M implies manually managed (pctused, freelists, etc are used to control space utilization) *Mbytes: allocated space of the tablespace, sum of mbytes consumed by all datafiles associated with tablespace. *Used: space in the tablespace that is used by some segment. *Free: space in the tablespace not allocated to any segment. *%Used: ratio of free to allocated space *largest: mostly useful with dictionary managed tablespaces, the size of the largest contiguous set of blocks available. If this number in a dictionary managed tablespace is smaller than the next extent for some object, that object could fail with “out of space” even if the FREE column says there is lots of free space. *MaxPoss Kbytes: the autoextend max size (note CAN be smaller than the allocated size!!!! you can set the maxsize to be less than the current size of a file) *%Max Used: how much of the maximum autoextend size has been used so far
6@@
Which schemas are taking up all of the space?
set pages 999 col “size MB” format 999,999,999 col “Objects” format 999,999,999 select obj.owner “Owner” , obj_cnt “Objects” , decode(seg_size, NULL, 0, seg_size) “size MB” from (select owner, count(*) obj_cnt from dba_objects group by owner) obj , (select owner, ceil(sum(bytes)/1024/1024) seg_size
from dba_segments group by owner) seg
where obj.owner = seg.owner(+) order by 3 desc , 2 desc , 1;
Show the ten largest objects in the database
colowner format a15 colsegment_name format a30 colsegment_type format a15 colmb format 999,999,999 select owner , segment_name , segment_type , mb from (
select owner
, segment_name
, segment_type
, bytes / 1024 / 1024 "MB"
from dba_segments
order by bytes desc
)
where 1=1 and rownum < 11;
Is java installed in the database?
This will return 9000'ish if it is select count(*) from all_objects where 1=1 and object_type like '%JAVA%' and owner = 'SYS';
Show character set information
select * from nls_database_parameters;
Show all used features
select name , detected_usages from dba_feature_usage_statistics where 1=1 and detected_usages > 0;
Move a database from one host to another without RMAN
Once upon a time, this was the only way to move a database to a different server. Now it's not common as RMAN can do it so well.<br /> On source server
Get a text version of the controlfile
7@@
Grab a copy of the pfile
8@@
Send these 2 files to the destination server
9@@
Shutdown the database
10@@
Copy the database datafiles to the new host (see in the controlfile creation script where they are)
As we are going to reopen the database with resetlogs, no need to copy the redo logs.<br /> As a new did will be created, no need to copy the archivelogs. If we need the old database back, we can just restart it on this server.
11@@
On destination server
Edit the files
- Change path names for new filesystem(s)
- Create any directories that don't exist (archivelog, audit, …)
- Modify the controlfile recreation script
- Remove Part #1 (use the resetlogs option)
- Change REUSE to SET
- Remove the recover database and open statements
- Comment out the alter tablespace temp statements. Might need it after opening.
Add database entry to /etc/oratab
Create or add entry to listener.ora
Create or add entry to tnsnames.ora
Setup environment for database
12@@
Copy init file to where it can be used
13@@
Create the new controlfile
14@@
Mount the database
15@@
Open the database
16@@
Check the database
17@@
