Показаны сообщения с ярлыком Oracle Database 12cR1. Показать все сообщения
Показаны сообщения с ярлыком Oracle Database 12cR1. Показать все сообщения

14 мая 2015 г.

on Leave a Comment

ADDM (Automatic Database Diagnostic Monitor) как его запустить?

    Что же делает этот ADDM? 
    ADDM анализирует данные из Automatic Workload Repository (AWR) и находит потенциальные узкие места. Для каждой найденной проблемы он попытается найти root cause и предоставить рекоммендации по ее устранению. 

    Как его запустить? 
Запустить его можно так:
1-й способ: из sqlplus запустить скрипт и следовать подсказкам.

10 окт. 2014 г.

on Leave a Comment

Get location of REDO log files

    The most crucial structure for recovery operations is the redo log, which consists of two or more preallocated files that store all changes made to the database as they occur. 
    Every instance of an Oracle Database has an associated redo log to protect the database in case of an instance failure.
Get location of REDO log files:
SQL> select current_scn from v$database;
on Leave a Comment

How to convert SCN to DATE and DATE to SCN

Sometimes it is very needed to convert SCN to DATE or DATE to SCN, so now I will tell you how to do it:
Get current SCN:
SQL> select current_scn from v$database;

7597825059

Convert SCN to DATE:
SQL> select scn_to_timestamp(7597825059) as timestamp from dual;

10-OCT-14 01.36.28.000000000 PM

Convert DATE TO SCN:
SQL> select timestamp_to_scn(to_timestamp('10/10/2014 10:24:54','DD/MM/YYYY HH24:MI:SS')) as scn from dual; 

7597430601

22 авг. 2014 г.

on

How to unlock Oracle database user

To unlock oracle database user just run this query:

SQL> ALTER USER user_name IDENTIFIED BY user_password ACCOUNT UNLOCK;

Now you can log in to the database using the user_name user with the password user_password. Remember, the password is case sensitive.

Example:

7 авг. 2014 г.

on Leave a Comment

How to check RMAN backups status when you use CATALOG

If you use CATALOG for RMAN backup you can just by using one SQL query to check whether backups are going well. Run this query as RMAN CATALOG owner user:

1. Connect to Database contained RMAN CATALOG as CATALOG owner user.
2. Run this query:
-- Run this query on RMANDBX instance:

SELECT
    DB_NAME,
    INPUT_TYPE,
    STATUS,
    TO_CHAR(START_TIME, 'MM-DD-YYYY HH24:MI:SS') START_TIME,
    TIME_TAKEN_DISPLAY TIME_TAKEN,
    INPUT_BYTES_DISPLAY INPUT_SIZE,
    OUTPUT_BYTES_DISPLAY OUTPUT_SIZE
  FROM RC_RMAN_BACKUP_JOB_DETAILS
  ORDER BY START_TIME
  DESC;


Result:


31 июл. 2014 г.

on Leave a Comment

Decrease the size of TEMP Datafile in Oracle 10g

You can resize the temp datafiles using the following steps:

1. Set the Database environment variables.

2. Connect to the target database:
  $ sqlplus / as sysdba

3. Resize the temp datafile:
  alter database tempfile '/u02/oradata/ORCL/temp2_01.dbf' resize 2G;

4. Example:



on Leave a Comment

How to Display the JAVA version used by database

To Display the JAVA version which is used by database you can use following steps:

$ cd $ORACLE_HOME/bin
$ ./java -version

Example:


30 июл. 2014 г.

on Leave a Comment

Rebuild TEMP tablespace

If you need to rebuild your temp tablespace, eg the existing one is corrupt or the wrong size, the trick is to temporarily give oracle a new one to use as its default temp tablespace while you replace the real one, then switch back.

1. Create new temporary tablespace:

 create temporary tablespace TEMP_TMP
 tempfile '/oracle/oradata/ORCL/temp02.dbf'
 size 1G reuse
 autoextend on next 100M maxsize unlimited;

2. Say to Oracle to use  new temporary tablespace:

 alter database default temporary tablespace TEMP_TMP;

3. Delete old temporary tablespace:

 drop tablespace TEMP including contents and datafiles;

4. Recreate old temporary tablespace

 create temporary tablespace TEMP
 tempfile '/oracle/oradata/ORCL/temp01.dbf'
 size 1G reuse
 autoextend on next 100M maxsize unlimited;

5. Say to Oracle to use a new temporary tablespace(old one):

alter database default temporary tablespace TEMP;


6. Delete unneeded tablespace:

drop tablespace TEMP_TMP including contents and datafiles;


7. Look results, whether all is as expected:

select * from dba_temp_files;

select * from dba_tablespaces;

28 июл. 2014 г.

on Leave a Comment

Display all Tables, Tablespaces in Database

How to display all Tables, Tablespaces in Database. Some examples:

At first you should connect to the Database:
 sqlplus username/password@database-name 
To display all tables owned by the current user:
 select tablespace_name, table_name from user_tables;
To display all tables in a database:
 select tablespace_name, table_name from dba_tables;
To list all tables accessible to the current user, type:
 select tablespace_name, table_name from all_tables;

Also You can find more info about views here: all_tables, user_tables, and dba_tables in Oracle Documentation.

22 июл. 2014 г.

on Leave a Comment

ORA-12547 TNS lost contact when try to connect to Oracle

ORA-12547 довольно распространенная ошибка при попытке соединиться с базой данных Oracle в ОС Unix/Linux с помощью утилиты SQLPLUS и под ОС пользователем не входящим в группу oinstall(группа, являющаяся владельцем Oracle binaries files).

sqlplus scott/tiger
SQL*Plus: Release 10.2.0.5.0 - Production on Wed May 18 09:32:35 2011
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
ERROR:
ORA-12547: TNS :lost contact when try to connect to Oracle.


Причины такой ошибки могут быть различными, но обычно проблема заключается в неверных правах на некоторые бинарные исполняемые файлы, находящиеся в директории $ORACLE_HOME/bin.

Решение:

  1. Убедитесь, что База Данных запущена и вы можете с ней соединиться, с помощью SQLPLUS с параметром AS SYSDBA под пользователем, который является владельцем бинарных исполняемых файлов, находящихся в директории $ORACLE_HOME/bin (Обычно это пользователь oracle:oinstall Unix / Linux). Если соединиться не получается даже под этим пользователем, то скорее всего у Вас какая-то другая проблема :( .
  2. Проверьте права на файл "oracle" в директории $ORACLE_HOME/bin:                              cd $ORACLE_HOME/bin
       ls -ltr oracle
       -rwxr-xr-x    1 oracle   oinstall       136803483 May 21 10:11 oracle
  3. Измените права, как показано ниже:                                        chmod 6751 oracle
      ls -ltr oracle
      -rwsr-s--x    1 oracle   oinstall       136803483 
    May 21 10:11 oracle
  4. Если это не помогло, то также проверьте права на остальные файлы в директории $ORACLE_HOME/bin.



21 июл. 2014 г.

on Leave a Comment

Полезные команды RMAN

Посмотреть все RMAN параметры для Базы Данных:
RMAN> show all;

Настройка Disk Channel к формату "/backup/ora_df%t_s%s_s%p":
RMAN> configure channel device type disk format '/backup/ora_df%t_s%s_s%p';

Выполнение бекапа Базы Данных, используя стандартные параметры RMAN: 
RMAN> backup database;

Вывести полную информацию о бекапах Базы Данных:
RMAN> list backup;

Вывести краткую информацию о бекапах Базы Данных:
RMAN> list backup summary;

RMAN  на уровне ОС проверит, существуют ли еще  все файлы бекапов Базы Данных в местах, где они должны быть, и это все на основании данных в каталоге или в control файле:
RMAN> crosscheck backup;

RMAN  на уровне ОС проверит, существуют ли еще  все файлы бекапов Архив Логов в местах, где они должны быть, и это все на основании данных в каталоге или в control файле:
RMAN> crosscheck archivelog all;

Если файлов не окажется в местах, где они должны лежать, то RMAN пометит их как "EXPIRED"

RMAN удалит все файлы, помеченные как "EXPIRED":
RMAN> delete expired backup;

То же самое, только для Архив Логов:
RMAN> delete expired archivelog;

RMAN выполнит бекап всех Архив Логов, а затем удалит все Архив логи из flash_recovery_area, но оставит бекапы:
RMAN> backup archivelog all delete input;
Технологии Blogger.