Posts Tagged ‘Oracle’
How To Shutdown Oracle Database
Friday, December 11th, 2009
Following three methods are available to shutdown the oracle database:
- Normal Shutdown
- Shutdown Immediate
- Shutdown Abort
1. Normal Shutdown
During normal shutdown, before the oracle database is shut down, oracle will wait for all active users to disconnect their sessions. As the parameter name (normal) suggest, use this option to shutdown the database under normal conditions.
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
(more…)
Tags: Database, Oracle
Posted in ORACLE-eng, Oracle | No Comments »
How To Startup Oracle Database
Friday, December 11th, 2009
1. Login to the system with oracle username
Typical oracle installation will have oracle as username and dba as group. On Linux, do su to oracle as shown below.
$ su - oracle
2. Connect to oracle sysdba
Make sure ORACLE_SID and ORACLE_HOME are set properly as shown below.
$ env | grep ORA
ORACLE_SID=DEVDB
ORACLE_HOME=/u01/app/oracle/product/10.2.0
You can connect using either “/ as sysdba” or an oracle account that has DBA privilege.
$ sqlplus '/ as sysdba' SQL*Plus: Release 10.2.0.3.0 - Production on Sun Jan 18 11:11:28 2009 Copyright (c) 1982, 2006, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production With the Partitioning and Data Mining options SQL>
3. Start Oracle Database
The default SPFILE (server parameter file) is located under $ORACLE_HOME/dbs. Oracle will use this SPFILE during startup, if you don’t specify PFILE.
Oracle will look for the parameter file in the following order under $ORACLE_HOME/dbs. If any one of them exist, it will use that particular parameter file.
- spfile$ORACLE_SID.ora
- spfile.ora
- init$ORACLE_SID.ora
Type “startup” at the SQL command prompt to startup the database as shown below.
SQL> startup
ORACLE instance started.
Total System Global Area 812529152 bytes
Fixed Size 2264280 bytes
Variable Size 960781800 bytes
Database Buffers 54654432 bytes
Redo Buffers 3498640 bytes
Database mounted.
Database opened.
SQL>
If you want to startup Oracle with PFILE, pass it as a parameter as shown below.
SQL> STARTUP PFILE=/u01/app/oracle/product/10.2.0/dbs/init.ora
Tags: Database, Oracle
Posted in ORACLE-eng, Oracle | 1 Comment »
Oracle ipuçları -1-
Friday, March 20th, 2009
Hazır sciptlerle oracleda basit işlemler yapabilmeniz için kısa kısa ipuçlarını vermeye çalışacağım. Aşağıdaki hazır scriptleri SQL PLUS ile çalıştrabilirsiniz. Öncelikle Linux oratamındaki Oracle database serverinize ssh ile bağlanın daha sonra SQL PLUS ortamına geçmek için aşağıdaki komutları yazın..
su – oracle
$ sqlplus / as sysdba
SQL>
Toplam veritabanınız için ayrılan alan ne kadar, Ayrılan alanın ne kadarı kullanılmış ne kadar boş alanınız kalmış (more…)
Tags: Oracle
Posted in Kategorilenmemiş | No Comments »
Oracle ipuçları -2- RMAN
Friday, March 20th, 2009
Yeni bir katalog oluşturma
create a tablespace
create a user
grant connect, resource, recovery_catalog_owner to user
rman catalog user/pass@db
create catalog tablespace “<tablespace_name>”;
Database kayıt etme(register)
rman catalog user/pass@rmandb target user/pass@db
register database;
Tags: Oracle, rman, script
Posted in Oracle | No Comments »
Oracle ipuçları -1- RAC
Friday, March 20th, 2009
Start, stop ve check CRS (Cluster Ready Services)
Cluster servisini start/stop edebilmek için servere root olarak bağlanmak gerekiyor.
Start CRS
crsctl start crs
Stop CRS
crsctl stop crs
CRS durumunu kontrol etmek için
crsctl check crs
Servislerin durumunu görmek için
crs_stat -t
Tags: Oracle, RAC, rman
Posted in Oracle | No Comments »
Oracle Import Utility
Friday, November 28th, 2008
Import extracts data from an export file and puts it back into an Oracle database. Import is command line not SQL command.Table objects are imported from the export file in the following order:1. Table definitions
2. Table data
3. Table indexes
4. Integrity constraints and triggers
Here are the list of import process order
1. New tables are created
2. Data is imported.
3. Indexes are built.
4. Triggers are imported,
5. Integrity constraints are enabled.
Note: Tablespace need to be create from the first place(if not exist), otherwise the object on the specific tablespace would not be able to be created.
To list exp parameter enter “exp HELP=y” .
More Information on Oracle Export at
- http://www.orafaq.com/wiki/Import
- http://www.orafaq.com/wiki/Import_Export_FAQ
Tags: Oracle
Posted in ORACLE-eng | 1 Comment »
SqlPlus’ta önceki komutlarınıza yukarı ok tuşuyla ulaşabilmek için
Saturday, November 1st, 2008
Linux ortamında SqlPlus’ta önceki komutlarınıza yukarı ok tuşuyla ulaşabilmeniz mümkün değil. Bazen aynı komutları peşpeşe yazmak hem çok vakit alıyor hemde çok can sıkıyor. Bu çok can sıkıcı durumdan kurtalmak için aşağıdaki adımları takip etmeniz yeterli….
öncelikle bu linkten http://utopia.knoware.nl/~hlub/uck/rlwrap/rlwrap-0.30.tar.gz rlwrap programını indirelim.
wget http://utopia.knoware.nl/~hlub/uck/rlwrap/rlwrap-0.30.tar.gz
tar zxvf rlwrap-0.30.tar.gz
cd rlwrap-0.30
./configure
make
make check
make install
Kurulum bittikten sonra
$ rlwrap sqlplus user/password@sid.
komutuyla direk sqlplusa girebileceğiniz gibi oracle useri profilinde alias tanımlayarak kendinize kısa yol oluşturabilirsiniz
/home/oracle/.bash_profile dosyası içine aşağıdaki satırı ekleyin.
alias sqlp =”rlwrap sqlplus”
Tags: Oracle, sqlplus
Posted in Oracle, ipucu | 1 Comment »
RMAN ile Backup &Restore
Friday, October 24th, 2008
RMAN (Recovery Manager), Oracle veritabanının yedeğinin alınmasını ve yedekten dönülebilmesini sağlayan en önemli seçeneklerden birisidir. RMAN ile Hot(online) backup, incremental backup,Full backup alınabilir. Spfile ve controlfile’ların yedeğini alabildiğimiz gibi alınan backuplardan Partial(PIT-Point in Time-Herhangi zamandaki bir noktaya) veya complete recovery yapabiliriz. Ancak RMAN ile sağlıklı bir şekilde yedek alabilmemiz için, veritabanımızın mutlaka ARCHIVELOG modunda olması gerekmektedir.
Veritabanımızı Archivelog’a geçirmek için;
$ sqlplus “/ as sysdba”
SQL> ALTER SYSTEM SET log_archive_start=TRUE SCOPE=SPFILE;
SQL> shutdown immediate;
SQL> STARTUP MOUNT;
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;
Artık RMAN ile database ile ilgili tüm yedekleri alabiliriz.Öncelikle rman konsoluna yetkili user ve password ile bağlanalım.
$ rman target username/password
Veritabanın online yedeğini almak için
RMAN>BACKUP DATABASE;
Veritbanı+ archivelogların yedeğini almak için
RMAN>BACKUP DATABASE PLUS ARCHIVELOG;
Yedeği alınmış archivelogları, yedek alınırken silmek için;
RMAN>BACKUP DATABASE PLUS ARCHIVELOG DELETE INPUT;
Yedeğin düzgün alınıp alınmadığını kontrol etmek için
RMAN>RESTORE DATABASE VALIDATE;
Control file dosyasını restore etmek için
RMAN> RESTORE CONTROLFILE;
Database restore etme
$ rman target / catalog rman/rman001@oracle2
RMAN> startup mount
RMAN> RESTORE DATABASE;
RMAN> RECOVER DATABASE;
RMAN> ALTER DATABASE OPEN;
Sık Kullanılan RMAN Komutları
|
Command |
Description |
|
@ |
Runs an RMAN script at the pathname specified after @. Default is current path. |
|
BACKUP |
Performs an RMAN backup with or without archived redo log files. Backs up datafiles, datafile copies, or performs incremental level 0 or level 1 backup. Also validates blocks to backed up with the VALIDATE clause. |
|
CHANGE |
Changes status of backup in RMAN repository – used to exclude a backup from a restore/recovery operation. Also used to notify RMAN that a backup file was removed by an operating system command outside of RMAN. |
|
CONFIGURE |
Configures RMAN persistent parameters. These parameters are available for subsequent sessions unless explicitly cleared/modified. |
|
CREATE CATALOG |
Creates a repository catalog with RMAN metadata for one (or more) target databases. |
|
CROSSCHECK |
Checks records of RMAN repository against actual disk or tape files. |
|
DELETE |
Deletes backup files or copies – removes the record of the backup file from the repository. |
|
FLASHBACK |
Performs a Flashback Database operation such as restoration to a point in time by SCN or log sequence. |
|
LIST |
Displays information about backupsets and image copies. |
|
RECOVER |
Performs complete or incomplete recovery on a datafile, tablespace, or entire database. Can apply incremental backups to roll forward. |
|
REGISTER DATABASE |
Registers a target database in the RMAN repository. |
|
REPORT |
Provides a detailed analysis of the RMAN repository. |
|
RESTORE |
Restores files from image copies or backupsets to disk – usually after a media failure. Can also be used to validate a restore operation without actually performing the restore by specifying the PREVIEW option. |
|
RUN |
Runs sequence of RMAN statements as a group between { and } – allows overriding RMAN parameters for the group of statements executed. |
|
SET |
Sets RMAN configuration settings for the duration of a RMAN session – not the same as CONFIGURE. |
|
SHOW |
Shows all or individual RMAN configured settings. |
|
SHUTDOWN |
Shuts down the target database with RMAN – same as SHUTDOWN within SQLPlus. |
|
STARTUP |
Starts up the target database with RMAN – same as STARTUP within SQLPlus. |
|
SQL |
Runs SQL commands – example: sql ‘ALTER TABLESPACE data01 OFFLINE IMMEDIATE’; — before a restore/recover operation. |
Tags: backup, Oracle, restore, rman
Posted in Oracle | 7 Comments »
system tablespace mutalaka backup alınmalı
Friday, October 24th, 2008
Eğer system tablespace tablespacelerinin düzenli backuplarını almazsanız; sisteminizdeki bu dosyanın bozulması durumunda veritabanınızdaki tüm datafile dosyalarını yedek almış olsanız bile bu data fileları backuptan geri dönemezsiniz….
Tags: backup, Oracle
Posted in Oracle, ipucu | No Comments »
Oracle Database Servere yeni control file dosyası nasıl eklenir
Friday, October 24th, 2008
1-Öncelikle instance shut down edilir
2-Mevcut conrol file lardan birisi yeni bir isimde yeni lokasyona kopyalanır.
3-init.ora dosyasına conrol file değişiklikleri eklenir
4-Database açılır.
Tags: control file, Oracle
Posted in Oracle, ipucu | No Comments »