Beruflich Dokumente
Kultur Dokumente
47. You want users to change their passwords every 2 months. How do you enforce
this?
52. What is the difference between Direct Path and Convention Path loading?
56. What is the difference between Range Partitioning and Hash Partitioning?
57. What is difference between Multithreaded/Shared Server and Dedicated Server?
58. Can you import objects from Oracle ver. 7.3 to 9i?
59. How do you move tables from one tablespace to another tablespace?
60. How do see how much space is used and free in a tablespace?
Contents
[hide]
• 11 Where can one find the high water mark for a table?
• 17 Tired of typing sqlplus '/as sysdba' every time you want to do something?
tkprof)?
One can create and modify Oracle databases using the Oracle DBCA (Database Configuration Assistant) utility. The dbca utility is located in the
$ORACLE_HOME/bin directory. The Oracle Universal Installer (oui) normally starts it after installing the database server software to create the starter database.
One can also create databases manually using scripts. This option, however, is falling out of fashion as it is quite involved and error prone. Look at this example
Oracle recommends that your database block size match, or be multiples of your operating system block size. One can use smaller block sizes, but the
performance cost is significant. Your choice should depend on the type of application you are running. If you have many small transactions as with OLTP, use a
smaller block size. With fewer but larger transactions, as with a DSS application, use a larger block size.
If you are using a volume manager, consider your "operating system block size" to be 8K. This is because volume manager products use 8K blocks (and this is not
configurable).
One should implement a monitoring system to constantly monitor the following aspects of a database. This can be achieved by writing custom scripts,
implementing Oracle's Enterprise Manager, or buying a third-party monitoring product. If an alarm is triggered, the system should automatically notify the DBA (e-
Infrastructure availability:
Are the Oracle Names and LDAP Servers up and responding to requests
Etc.
Things that can cause service outages:
Tablespaces running low on free space/ Objects what would not be able to extend
Etc.
Start by making a full database backup of your database (in case you need to restore if this procedure is not working).
Locate the latest dump file in your USER_DUMP_DEST directory (show parameter USER_DUMP_DEST) - rename it to something like dbrename.sql.
Edit dbrename.sql, remove all headers and comments, and change the database's name. Also change "CREATE CONTROLFILE REUSE ..." to "CREATE
Shutdown the database (use SHUTDOWN NORMAL or IMMEDIATE, don't ABORT!) and run dbrename.sql.
drop user A
To add more space to a tablespace, one can simply add another file to it. Example:
Resize datafiles
One can manually increase or decrease the size of a datafile from Oracle 7.2 using the following command:
Because you can change the sizes of datafiles, you can add more space to your database without adding more datafiles. This is beneficial if you are concerned
Manually reducing the sizes of datafiles allows you to reclaim unused space in the database. This is useful for correcting errors in estimations of space
requirements.
Extend datafiles
Also, datafiles can be allowed to automatically extend if more space is required. Look at the following commands:
The biggest portion of a database's size comes from the datafiles. To find out how many megabytes are allocated to ALL datafiles:
Select from the DBA_SEGMENTS or DBA_EXTENTS views to find the used space of a database. Example:
[edit]Where can one find the high water mark for a table?
There is no single system table which contains the high water mark (HWM) for a table. A table's HWM can be calculated using the results from the following SQL
statements:
SELECT BLOCKS
FROM DBA_SEGMENTS
WHERE OWNER=UPPER(owner) AND SEGMENT_NAME = UPPER(table);
SELECT EMPTY_BLOCKS
FROM DBA_TABLES
WHERE OWNER=UPPER(owner) AND TABLE_NAME = UPPER(table);
NOTE: You can also use the DBMS_SPACE package and calculate the HWM = TOTAL_BLOCKS - UNUSED_BLOCKS - 1.
Unlike normal tablespaces, true temporary tablespace information is not listed in DBA_FREE_SPACE. Instead use the V$TEMP_SPACE_HEADER view:
For every user using temporary space, there is an entry in SYS.V$_LOCK with type 'TS'.
All temporary segments are named 'ffff.bbbb' where 'ffff' is the file it is in and 'bbbb' is first block of the segment.
If your temporary tablespace is set to TEMPORARY, all sorts are done in one large temporary segment. For usage stats, see SYS.V_$SORT_SEGMENT
From Oracle 8, one can just query SYS.v$sort_usage. Look at these examples:
Execute the following query to determine who is using a particular UNDO or Rollback Segment:
SQL> SELECT TO_CHAR(s.sid)||','||TO_CHAR(s.serial#) sid_serial,
2 NVL(s.username, 'None') orauser,
3 s.program,
4 r.name undoseg,
5 t.used_ublk * TO_NUMBER(x.value)/1024||'K' "Undo"
6 FROM sys.v_$rollname r,
7 sys.v_$session s,
8 sys.v_$transaction t,
9 sys.v_$parameter x
10 WHERE s.taddr = t.addr
11 AND r.usn = t.xidusn(+)
12 AND x.name = 'db_block_size'
[edit]Tired of typing sqlplus '/as sysdba' every time you want to do something?
If you are tired of typing sqlplus "/as sysdba" every time you want to perform some DBA task, implement the following shortcut:
On Unix/Linux systems:
On Windows systems:
Create a batch file, sss.bat, add the command to it, and place it somewhere in your PATH. Whenever you now want to start sqlplus as sysdba, just type "sss".
Note: From Oracle 10g you don't need to put the "/AS SYSDBA" in quotes anymore.
DBA's often do not document the patches they install. This may lead to situations where a feature works on machine X, but not on machine Y. This FAQ will show
how you can list and compare the patches installed within your Oracle Homes.
All patches that are installed with Oracle's OPatch Utility (Oracle's Interim Patch Installer) can be listed by invoking the opatch command with
$ cd $ORACLE_HOME/OPatch
$ opatch lsinventory
Invoking OPatch 10.2.0.1.0
OPatch succeeded.
NOTE: If OPatch is not installed into your Oracle Home ($ORACLE_HOME/OPatch), you may need to download it from Metalink and install it yourself.
[edit]How does one give developers access to trace files (required as input to tkprof)?
The alter session set sql_trace=true command generates trace files in USER_DUMP_DEST that can be used by developers as input to tkprof. On Unix the default
There is an undocumented INIT.ORA parameter that will allow everyone to read (rwx r-- r--) these trace files:
_trace_files_public = true
Include this in your INIT.ORA file and bounce your database for it to take effect.
• page
• discussion
• edit
• history
• Log in
site navigation
Wiki Home
Forum Home
Blogger Home
site highlights
Blog Aggregator
FAQ's
Mailing Lists
Usenet News
RSS Feeds
wiki navigation
Categories
Recent changes
Random page
Help
search
Top of Form
Go Search
Bottom of Form
toolbox
Related changes
Upload file
Special pages
Printable version
Permanent link
.:: Wiki Home :: Blogger Home :: Forum Home :: Contact :: Privacy ::.
vv