Download Oracle

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Oracle
??????????
• 1 ??????? ?? ????????? ? ?????? ? Oracle
♦ 1.1 ????????? ORACLE 10 ?? Solaris
◊ 1.1.1 ?????????? ? ?????????
◊ 1.1.2 ?????????
◊ 1.1.3 Post-install
♦ 1.2 ???????? ???? ??????
◊ 1.2.1 ??????? ????
◊ 1.2.2 OMF: minimal manual Oracle create database syntax
♦ 1.3 ???????? ????????
♦ 1.4 ????? ? ?? ??????????
♦ 1.5 ???????
♦ 1.6 ?????????????? ?????
♦ 1.7 ??????
??????? ?? ????????? ? ?????? ? Oracle
????????? ORACLE 10 ?? Solaris
?????????? ? ?????????
• ???????? ???????????? oracle, ?????? ??? ??????
useradd -d /export/home/oracle -m -s /usr/bin/bash oracle
passwd oracle
• ??????? 2 ??????, dba ? oinstall (?????????? ?????? - ??? ?? ????), ???????? ???????????? ? ??????
grouppadd dba
grouppadd oinstall
usermod -g dba -G oinstall oracle
• ????????? ??????? ?????????? ?????. (? ???? ?????? - ? ??????? /export)
• ?????????? ???????? ?????????? ????????? (? ?????? ?? ??? ? .profile ??? ?? .bashrc):
# su - oracle
Sun Microsystems Inc.
SunOS 5.10
Generic January 2005
-bash-3.00$ env
HZ=
SHELL=/usr/bin/bash
TERM=xterm
TMPDIR=/tmp
ORACLE_SID=orcl
ORACLE_BASE=/export/home/oracle
MAIL=/usr/mail/oracle
PATH=/export/home/oracle/10g/bin:/usr/bin:
PWD=/export/home/oracle
TZ=EET
SHLVL=1
HOME=/export/home/oracle
TMP=/tmp
LOGNAME=oracle
DISPLAY=localhost:0.0
ORACLE_HOME=/export/home/oracle/10g
• ??????? ??????????????? ????? ?? ftp (????? ? ??????? oracle, ??? ??????????? ????? ????????? ??? ????????? oracle)
• ???????? ???????????.
?????????
? ???????? ????????? ??????????? ???????? ???????? ??????? (???????? ????????? ????, ??????? ? ????? /etc/system), ????? ?? ????? ?
??????. ????? ???? ??????????? ??????? ?????????.
??????????? ???????? ????????? ?? ???? 1 ???? (??????) ??? ????????? ?????????? ? /usr/local/bin
????????: ??????????? ????????? ??? ?????????? ????????? ? ???????? ORACLE_SID ??????????? ?????. ??? ????? ??????
bash-3.00$ /export/home/oracle/10g/bin/emctl start dbconsole
??????????? ? ???????. ??? ???????? ?????????? ?????????? ?? ???? ? ????????????? ??????.
???? ????????? ?????? ? ???? ????? 1 ????.
Post-install
? ????? /$ORACLE_HOME/10g/bin/dbstart (?????? 77)
#ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle
ORACLE_HOME_LISTNER=$ORACLE_HOME
???????? ???? ??????
????????? ? ???? ?????? (?????????) ? ??????? ?? MySQL ?????? ???? ?????? ????????????? ????? ????????? (instance)
? ???? ?????? ? ????? ??? ??? ???????????? oracle (? ????????? ??????, ????????, ?? ?????????? ???????????? ? ???? ??? sysdba)
??????? ????
export ORACLE_SID=test
export ORACLE_HOME=/path/to/oracle/home
Create a minimal init.ora
# $ORACLE_HOME/dbs/init<sid>.ora
control_files = (/path/to/control1.ctl,/path/to/control2.ctl,/path/to/control3.ctl)
undo_management = AUTO
undo_tablespace = UNDOTBS1
db_name = test
db_block_size = 8192
sga_max_size = 1073741824 #one gig
sga_target = 1073741824 #one gig
Create a password file
$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/pwd<sid>.ora password=oracle entries=5
Start the instance
sqlplus / as sysdba
startup nomount
Create the database
create database test
logfile group 1 ('/path/to/redo1.log') size 100M,
group 2 ('/path/to/redo2.log') size 100M,
group 3 ('/path/to/redo3.log') size 100M
character set WE8ISO8859P1
national character set utf8
datafile '/path/to/system.dbf' size 500M autoextend on next 10M maxsize unlimited extent management local
sysaux datafile '/path/to/sysaux.dbf' size 100M autoextend on next 10M maxsize unlimited
undo tablespace undotbs1 datafile '/path/to/undotbs1.dbf' size 100M
default temporary tablespace temp tempfile '/path/to/temp01.dbf' size 100M;
Note: there's some other things you can do here, like "ARCHIVELOG" "SET TIME_ZONE =" and "USER SYS IDENTIFIED BY password" and "USER
SYSTEM IDENTIFIED BY password"
6. Run catalog and catproc
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
7. Change passwords
alter user sys identified by whatever;
alter user system identified by whatever;
OMF: minimal manual Oracle create database syntax
Set your ORACLE_SID
export ORACLE_SID=test
export ORACLE_HOME=/path/to/oracle/home
Create a minimal init.ora
# $ORACLE_HOME/dbs/init<sid>.ora
control_files = (/path/to/control1.ctl,/path/to/control2.ctl,/path/to/control3.ctl)
undo_management = AUTO
db_name = test
db_block_size = 8192
sga_max_size = 1073741824 #one gig
sga_target = 1073741824 #one gig
db_create_file_dest = /path/to/datafile/location #OMF
db_create_online_log_dest_1 = /path/to/first/redo_and_control_file/location #OMF
db_create_online_log_dest_2 = /path/to/second/redo_and_control_file/location #OMF
db_recovery_file_dest = /path/to/flash/recovery/area #OMF
#note it?s a good idea to also have background_dump_dest, user_dump_dest, and core_dump_dest here as well
3. Create a password file
$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/pwd<sid>.ora password=oracle entries=5
4. Start the instance
sqlplus / as sysdba
startup nomount
5. Create the database
create database test
character set WE8ISO8859P1
national character set utf8
undo tablespace undotbs1
default temporary tablespace temp;
You can even do this and it will work, the ultimate in minimalism:
create database test;
Note: There's some other things you can do here, like "ARCHIVELOG" "SET TIME_ZONE =" and "USER SYS IDENTIFIED BY password" and "USER
SYSTEM IDENTIFIED BY password"
Note 2: This is so minimal because you are using Oracle Managed Files as seen in #2
6. Run catalog and catproc
@?/rdbms/admin/catalog.sql
@?/rdbms/admin/catproc.sql
Standard create Oracle database syntax
After creating your init.ora file with the appropriate parameters you can use the "create database" command in SQL*Plus to create a database:
Make sure that your have your $ORACLE_HOME and $ORACLE_SID set properly and that you sign-on as SYSDBA:
startup nomount;
CREATE CONTROLFILE REUSE DATABASE "OLDLSQ" NORESETLOGS
NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 240
MAXINSTANCES 1
MAXLOGHISTORY 113
LOGFILE
GROUP 1 ('/u03/oradata/oldlsq/log1a.dbf',
'/u03/oradata/olslsq/log1b.dbf') SIZE 30M,
GROUP 2 ('/u04/oradata/oldlsq/log2a.dbf',
'/u04/oradata/oldlsq/log2b.dbf') SIZE 30M
DATAFILE
'/u01/oradata/oldlsq/system01.dbf',
'/u01/oradata/oldlsq/mydatabase.dbf'
;
???????? ????????
??? ???????? ??????? ????? su - oracle
lsnrctl status
bash-3.00$ lsnrctl status
LSNRCTL for Solaris: Version 10.2.0.1.0 - Production on 27-MAY-2010 10:55:05
Copyright (c) 1991, 2005, Oracle.
All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
-----------------------Alias
LISTENER
Version
TNSLSNR for Solaris: Version 10.2.0.1.0 - Production
Start Date
27-MAY-2010 09:25:39
Uptime
0 days 1 hr. 29 min. 25 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF
Listener Parameter File
/oracle/10g/network/admin/listener.ora
Listener Log File
/oracle/10g/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=solaris-test)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
bash-3.00$ tnsping test-solaris
TNS Ping Utility for Solaris: Version 10.2.0.1.0 - Production on 27-MAY-2010 11:00:22
Copyright (c) 1997, 2005, Oracle.
All rights reserved.
Used parameter files:
/oracle/10g/network/admin/sqlnet.ora
TNS-03505: Failed to resolve name
bash-3.00$ tnsping solaris-test
TNS Ping Utility for Solaris: Version 10.2.0.1.0 - Production on 27-MAY-2010 11:00:29
Copyright (c) 1997, 2005, Oracle.
All rights reserved.
Used parameter files:
/oracle/10g/network/admin/sqlnet.ora
Used EZCONNECT adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=solaris-test.))(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.2.2)(PORT=1521)))
OK (10 msec)
????? ? ?? ??????????
/var/opt/oracle/oratab
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#
$ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/export/home/oracle/10g:Y
???????
• ????? (Schema) - ????????? ???????? ??. (?????? database ? mysql ? )
?????????????? ?????
select
,
,
,
tsu.tablespace_name, ceil(tsu.used_mb) "size MB"
decode(ceil(tsf.free_mb), NULL,0,ceil(tsf.free_mb)) "free MB"
decode(floor(tsu.used_mb- tsf.free_mb), NULL,0,floor(tsu.used_mb- tsf.free_mb)) "used MB"
decode(100 - ceil(tsf.free_mb/tsu.used_mb*100), NULL, 100,
100 - ceil(tsf.free_mb/tsu.used_mb*100)) || ' %' "% used"
from
(select tablespace_name, sum(bytes)/1024/1024 used_mb
from
dba_data_files group by tablespace_name ) tsu
,
(select tablespace_name, sum(bytes)/1024/1024 free_mb
from
dba_free_space group by tablespace_name) tsf
where
tsu.tablespace_name = tsf.tablespace_name (+)
order
by (decode(100 - ceil(tsf.free_mb/tsu.used_mb*100), NULL, 100, 100 - ceil(tsf.free_mb/tsu.used_mb*100))) desc
[15:08:00] Oleg YUrchenko: http://www.dba.az/index.php?option=com_content&view=article&id=58:dbafreespace-misunderstanding-how-oracle-populate
??????
• ????????? ?? ??????? 10 (? ?????? ??????????? ?? ????? ?????????)
• http://www.sql.ru/Forum/actualthread.aspx?tid=762404
Related documents