oracle rdbms beginner's guide

Upload: taras-lyuklyanchuk

Post on 02-Mar-2018

235 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    1/16

    1

    Oracle RDBMS User Manual

    : 15.02.2015

    : 19.02.2015: 1.1

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    2/16

    2

    ......................................................................................................................................................... 2

    .............................................................................................................................................................. 3

    .......................................................................................................................................... 3 .......................................................................................................................................................... 3 .......................................................................................................................................... 4 ............................................................................................................................................. 4

    .................................................................................................................................... 5

    ........................................................................................................................................................... 5 ....................................................................................................................................................................... 6 .............................................................................................................................................................. 7

    ................................................................................................................................................................. 8

    ................................................................................................................................... 10

    LEGACY-............................................................................................................................................. 10 DATAPUMP....................................................................................................................................... 11 ......................................................................................................................... 13

    ............................................................................................................................................. 15

    ........................................................................................................................................................ 15 ....................................................................................................................................................... 15

    1.0 15.02.2015

    1.1 19.02.2015

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    3/16

    3

    Oracle USERS. , , .

    . , , .

    CREATE TABLESPACE DATADATAFILE '/u01/oracle/oradata/ora11/data01.dbf' SIZE 1024M AUTOEXTEND ONNEXT 256M MAXSIZE UNLIMITED

    EXTENT MANAGEMENT LOCAL AUTOALLOCATELOGGINGONLINESEGMENT SPACE MANAGEMENT AUTO;

    DATA, - /u01/oracle/oradata/ora11/data01.dbf.

    PaymentEngine .

    :

    create user IBPEdefault tablespace DATAtemporary tablespace TEMPidentified by "password";

    :DATA -TEMP

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    4/16

    4

    Oracle 11, DEFAULT (- 180 ). . , :

    create profile UNEXPIREABLE LIMIT PASSWORD_LIFE_TIME UNLIMITED;

    IBPE:

    alter user IBPE profile UNEXPIREABLE;

    -- Grant/Revoke object privilegesgrant select on SYS.DBA_2PC_PENDING to IBPE;grant select on SYS.DBA_PENDING_TRANSACTIONS to IBPE;grant execute on SYS.DBMS_LOCK to IBPE;

    grant execute on SYS.DBMS_XA to IBPE;grant select on SYS.PENDING_TRANS$ to IBPE;grant select on SYS.V_$SESSION to IBPE;

    -- Grant/Revoke role privilegesgrant connect to IBPE;grant javauserpriv to IBPE;

    -- Grant/Revoke system privilegesgrant create procedure to IBPE;grant create sequence to IBPE;grant create session to IBPE;

    grant create synonym to IBPE;grant create table to IBPE;grant create trigger to IBPE;grant create type to IBPE;grant create view to IBPE;grant unlimited tablespace to IBPE;

    dev/test :

    grant debug any procedure to IBPE;grant debug connect session to IBPE;

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    5/16

    5

    1. SSH oracle. oracle

    , , , root, oracle:

    login as: rootUsing keyboard-interactive authentication.Password:Last login: Thu Apr 2 12:54:32 2015 from 192.168.77.38

    apricot:~ # su - oracle

    oracle@apricot:~>

    2. Oracle, ORACLE_SID:

    oracle@apricot:~> export ORACLE_SID=ora11; echo $ORACLE_SIDora11oracle@apricot:~>

    , ORACLE_SID .

    3. SYS:

    oracle@apricot:~> sqlplus / as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Sun Apr 5 18:23:54 2015Copyright (c) 1982, 2013, Oracle. All rights reserved.

    Connected to an idle instance.

    SQL>

    Connected to an idle instance , .

    4. :

    SQL> startup;ORACLE instance started.

    Total System Global Area 2137886720 bytesFixed Size 2254952 bytes

    Variable Size 570427288 bytesDatabase Buffers 1560281088 bytesRedo Buffers 4923392 bytes

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    6/16

    6

    Database mounted.Database opened.SQL>

    1. SSH oracle. oracle , , , root, oracle:

    login as: rootUsing keyboard-interactive authentication.Password:Last login: Thu Apr 2 12:54:32 2015 from 192.168.77.38

    apricot:~ # su - oracle

    oracle@apricot:~>

    2. Oracle, ORACLE_SID:

    oracle@apricot:~> export ORACLE_SID=ora11; echo $ORACLE_SIDora11

    oracle@apricot:~>

    , ORACLE_SID .

    3.

    oracle@apricot:~> lsnrctl start

    LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 05-APR-2015 18:28:34

    Copyright (c) 1991, 2013, Oracle. All rights reserved.

    Starting /opt/oracle/product/ora11/bin/tnslsnr: please wait...

    TNSLSNR for Linux: Version 11.2.0.4.0 - ProductionLog messages written to/opt/oracle/diag/tnslsnr/apricot/listener/alert/log.xmlListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=apricot)(PORT=1521)))

    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))STATUS of the LISTENER------------------------

    Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.4.0 - ProductionStart Date 05-APR-2015 18:28:34

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    7/16

    7

    Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Log File/opt/oracle/diag/tnslsnr/apricot/listener/alert/log.xmlListening Endpoints Summary...(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=apricot)(PORT=1521)))

    The listener supports no servicesThe command completed successfully

    1. SSH oracle. oracle , , , root, oracle:

    login as: rootUsing keyboard-interactive authentication.Password:Last login: Thu Apr 2 12:54:32 2015 from 192.168.77.38

    apricot:~ # su - oracle

    oracle@apricot:~>

    2. Oracle, ORACLE_SID:

    oracle@apricot:~> export ORACLE_SID=ora11; echo $ORACLE_SIDora11oracle@apricot:~>

    , ORACLE_SID

    .

    3. SYS:

    oracle@apricot:~> sqlplus / as sysdba

    SQL*Plus: Release 11.2.0.4.0 Production on Sun Apr 5 18:23:54 2015Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to an idle instance.

    SQL>

    Connected to an idle instance , .

    4. :

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    8/16

    8

    SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.

    SQL>

    1. SSH oracle. oracle , , , root, oracle:

    login as: rootUsing keyboard-interactive authentication.Password:Last login: Thu Apr 2 12:54:32 2015 from 192.168.77.38

    apricot:~ # su - oracle

    oracle@apricot:~>

    2. Oracle,

    ORACLE_SID:

    oracle@apricot:~> export ORACLE_SID=ora11; echo $ORACLE_SIDora11oracle@apricot:~>

    , ORACLE_SID .

    3.

    oracle@apricot:~> lsnrctl stop

    LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 05-APR-2015 18:48:23

    Copyright (c) 1991, 2013, Oracle. All rights reserved.

    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))The command completed successfully

    oracle@apricot:~>

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    9/16

    9

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    10/16

    10

    .

    :

    1.

    legacy- (imp/exp)2. DataPump- (impdp/expdp).3. SQL-

    legacy-

    ! Oracle Database Client. :http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-

    098987.html.

    ! ! - , . .

    :

    1. 2. ibpe_imp.conf:

    file=ibpe.dumpignore=yindexes=yrows=yconstraints=yfull=nlog=ibpe_imp.log

    buffer=1048560fromuser=ibpetouser=ibpe

    commit=yuserid=ibpe/password@db

    userid .

    3. ibpe_imp.cmd

    . log- ibpe_imp.log

    http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-098987.htmlhttp://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-098987.htmlhttp://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-098987.htmlhttp://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-098987.htmlhttp://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-098987.html
  • 7/26/2019 Oracle RDBMS Beginner's Guide

    11/16

    11

    DataPump

    DataPump / Oracle.

    .

    ! Oracle Client. :http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-

    098987.html

    ! ! - , . .

    :

    1. 2. ibpe_impdp.conf:

    USERID="sys/password@DB as sysdba"SCHEMAS=IBPEDIRECTORY=DATA_PUMP_DIRLOGFILE=ibpe.logDUMPFILE=ibpe.dump

    http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-098987.htmlhttp://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-098987.htmlhttp://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-098987.htmlhttp://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-098987.htmlhttp://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft-098987.html
  • 7/26/2019 Oracle RDBMS Beginner's Guide

    12/16

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    13/16

    13

    SQL-.

    :1. ibpe_schema.pdcDDL-, 2. ibpe_insert.pdcDML-,

    ! ! - , . .

    :1. (

    )

    2. ibpe_schema.pdc

    sqlplus ibpe/password@DB @ibpe_schema.pdc

    3. ibpe_insert.pdc

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    14/16

    14

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    15/16

    15

    . - , .

    :

    drop user IBPE cascade;

    , IBPE,

    .

    , , .

    drop_schema.pdc

    sqlplus ibpe/password@DB @drop_schema.pdc

    , SQL-:

    select count(*) from all_objects where owner = 'IBPE' and object_type !='LOB';

  • 7/26/2019 Oracle RDBMS Beginner's Guide

    16/16

    16