Вы находитесь на странице: 1из 16

1

Oracle RDBMS User Manual

15.02.2015

19.02.2015

1.1

......................................................................................................................................................... 2
.............................................................................................................................................................. 3
.......................................................................................................................................... 3
.......................................................................................................................................................... 3
.......................................................................................................................................... 4
............................................................................................................................................. 4
.................................................................................................................................... 5
........................................................................................................................................................... 5
....................................................................................................................................................................... 6
.............................................................................................................................................................. 7
................................................................................................................................................................. 8
................................................................................................................................... 10
LEGACY- ............................................................................................................................................. 10
DATAPUMP ....................................................................................................................................... 11
......................................................................................................................... 13
............................................................................................................................................. 15
........................................................................................................................................................ 15
....................................................................................................................................................... 15


1.0
1.1

15.02.2015
19.02.2015


Oracle USERS. ,
, .
. ,
, .

CREATE TABLESPACE DATA
DATAFILE '/u01/oracle/oradata/ora11/data01.dbf' SIZE 1024M AUTOEXTEND ON
NEXT 256M MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
LOGGING
ONLINE
SEGMENT SPACE MANAGEMENT AUTO;

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


PaymentEngine
.
:
create user IBPE
default tablespace DATA
temporary tablespace TEMP
identified by "password";

:
DATA -
TEMP


Oracle 11, DEFAULT
(- 180 ).
. ,
:
create profile UNEXPIREABLE LIMIT PASSWORD_LIFE_TIME UNLIMITED;

IBPE:
alter user IBPE profile UNEXPIREABLE;

-- Grant/Revoke object privileges


grant 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 privileges
grant connect to IBPE;
grant javauserpriv to IBPE;
-- Grant/Revoke system privileges
grant 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;



1. SSH oracle. oracle
, , , root,
oracle:
login as: root
Using 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_SID
ora11
oracle@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 2015
Copyright (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 bytes
Fixed Size
2254952 bytes
Variable Size
570427288 bytes
Database Buffers
1560281088 bytes
Redo Buffers
4923392 bytes

Database mounted.
Database opened.
SQL>


1. SSH oracle. oracle
, , , root,
oracle:
login as: root
Using 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_SID
ora11
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 - Production
Log messages written to
/opt/oracle/diag/tnslsnr/apricot/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=apricot)(PORT=1521)))
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
-----------------------Alias
LISTENER
Version
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date
05-APR-2015 18:28:34

Uptime
0 days 0 hr. 0 min. 0 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF
Listener Log File
/opt/oracle/diag/tnslsnr/apricot/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=apricot)(PORT=1521)))
The listener supports no services
The command completed successfully


1. SSH oracle. oracle
, , , root,
oracle:
login as: root
Using 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_SID
ora11
oracle@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 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL>

Connected to an idle instance , .


4. :

SQL> shutdown immediate;


Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>


1. SSH oracle. oracle
, , , root,
oracle:
login as: root
Using 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_SID
ora11
oracle@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:~>

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-win32soft098987.html.
! ! , .
.
:
1.
2. ibpe_imp.conf:
file=ibpe.dump
ignore=y
indexes=y
rows=y
constraints=y
full=n
log=ibpe_imp.log
buffer=1048560
fromuser=ibpe
touser=ibpe
commit=y
userid=ibpe/password@db

userid
.
3. ibpe_imp.cmd
. log- ibpe_imp.log

11

DataPump
DataPump / Oracle.

.
!

Oracle
Client.

:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win32soft098987.html
! ! , .
.
:
1.
2. ibpe_impdp.conf:
USERID="sys/password@DB as sysdba"
SCHEMAS=IBPE
DIRECTORY=DATA_PUMP_DIR
LOGFILE=ibpe.log
DUMPFILE=ibpe.dump

12

USERID ,
( SYS) .
3. (*.dump) DATA_PUMP_DIR . ( $ORACLE_BASE/admin/$SID/dpdump ). DATA_PUMP_DIR
SQL-
select t.directory_path
'DATA_PUMP_DIR'

from

all_directories

where

t.directory_name

4. ibpe_impdp.cmd
. log- DATA_PUMP_DIR/ibpe.log
.

13

SQL-.
:
1. ibpe_schema.pdc DDL-,
2. ibpe_insert.pdc DML-,
! ! , .
.
:
1. (
)
2. ibpe_schema.pdc
sqlplus ibpe/password@DB @ibpe_schema.pdc

3. ibpe_insert.pdc

14

15


. -
, .

drop user IBPE cascade;

, IBPE,
.


, ,
.
drop_schema.pdc
sqlplus ibpe/password@DB @drop_schema.pdc <schema_name>

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

16