Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle study-Oracle 11g OCM examination (1)

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Oracle study-Oracle 11g OCM examination (1)

System environment: RedHat EL64

Oracle: Oracle 11gR2

Oracle 11g OCM exam the first question, manual construction of the database, reference documentation. The reference staff must be very familiar with the documentation in order to complete the task within the specified time.

1. View the system environment

[oracle@rh74 ~] $cat .bash _ profile

# .bash _ profileexport EDITOR=viexport ORACLE_SID=prodexport ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1export LD_LIBRARY_PATH=$ORACLE_HOME/libexport PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/binumask 022

[oracle@rh74 ~] $id oracle

Uid=300 (oracle) gid=501 (oinstall) groups=501 (oinstall), 502 (dba)

2. Establish the database pfile file

[oracle@rh74 dbs] $pwd

/ u01/app/oracle/product/11.2.0/db_1/dbs

[oracle@rh74 dbs] $ls

Hc_DBUA3908922.dat init.bk inittest2.ora lkTEST2 orapwtest2

Hc_prod.dat initDBUA3908922.ora inittest.ora orapwDBUA3908922 snapcf_prod.f

Hc_test2.dat init.ora lkPROD orapwprod spfileprod.ora

Hc_test.dat initprod.ora lkTEST orapwtest spfiletest2.ora

[oracle@rh74 dbs] $cat init.ora | grep-v "^ #" | grep-v "^ $" > inittest1.ora

Edit the pfile file:

[oracle@rh74 dbs] $cat inittest1.ora

Db_name='test1'memory_target=300mprocesses = 150audit_file_dest='$ORACLE_BASE/admin/test1/adump'audit_trail = 'db'db_block_size=8192db_domain=''diagnostic_dest=$ORACLE_BASEopen_cursors=300 remote_login_passwordfile='EXCLUSIVE'undo_tablespace='UNDOTBS1'control_files =' / u01/app/oracle/oradata/test1/control01.ctl'compatible = '11.2.0'

Set up the appropriate directory:

[oracle@rh74 dbs] $mkdir-p / u01/app/oracle/admin/test1/adump

[oracle@rh74 dbs] $mkdir-p / u01/app/oracle/oradata/test1

Create an Instance password file:

[oracle@rh74 dbs] $orapwd file=orapwtest1 password=oracle entries=3

Create a script to build the database:

Reference:

[oracle@rh74 ~] $cat cr_db.sql

CREATE DATABASE test1 USER SYS IDENTIFIED BY oracle USER SYSTEM IDENTIFIED BY oracle LOGFILE GROUP 1 ('/ u01ax SIZE SIZE 100m BLOCKSIZE 512) GROUP 2 ('/ u01 SIZE REUSE SYSAUX DATAFILE') SIZE 100m BLOCKSIZE 512 MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 CHARACTER SET zhs16gbk EXTENT MANAGEMENT LOCAL DATAFILE'/ u01 SIZE SIZE 01.dbf' SIZE 325m REUSE SYSAUX DATAFILE'/ u01 SIZE 20m REUSE UNDO TABLESPACE undotbs1 DATAFILE'/ u01 SIZE REUSE AUTOEXTEND ON MAXSIZE UNLIMITED

3. Start Instance to nomount, and run the script to build the database:

[oracle@rh74 ~] $export ORACLE_SID=test1

[oracle@rh74] $sqlplus'/ as sysdba'SQL*Plus: Release 11.2.0.3.0 Production on Fri Apr 8 17:09:02 2016Copyright (c) 1982, 2011, Oracle. All rights reserved.Connected to an idle instance.17:09:02 SYS@ test1 > startup nomount;ORACLE instance started.Total System Global Area 313159680 bytesFixed Size 2227944 bytesVariable Size 218104088 bytesDatabase Buffers 88080384 bytesRedo Buffers 4747264 bytes17:14:17 SYS@ test1 > select status from

17:15:15 SYS@ test1 > @ / home/oracle/cr_db.sql

Database created.

4. After building the database, set up the data dictionary through script.

[oracle@rh74 ~] $cat cr_dict.sql

@? / rdbms/admin/catalog.sql

@? / rdbms/admin/catproc.sql

Conn system/oracle

@? / sqlplus/admin/pupbld.sql

17:31:44 SYS@ test1 > @ / home/oracle/cr_dict.sql

5. Build the database successfully and set up default tablespace

19:24:34 SYSTEM@ test1 > create tablespace users

Datafile'/ u01 size

Tablespace created.

19:25:57 SYSTEM@ test1 > alter database default tablespace users

Database altered.

19:27:52 SYSTEM@ test1 > select tablespace_name,file_id,file_name from dba_data_files

TABLESPACE_NAME FILE_ID FILE_NAME---SYSTEM 1 / u01/app/oracle/oradata/test1 / system01.dbfSYSAUX 2 / u01/app/oracle/oradata/test1/sysaux01.dbfUNDOTBS1 3 / u01/app/oracle/oradata/test1/undotbs01.dbfUSERS 4 / u01/app/oracle/oradata/test1/users01.dbf4 rows selected.

6. Configure the network (tnsnames)

[oracle@rh74 admin] $cat tnsnames.ora

TEST1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = rh74) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test1)

[oracle@rh74 admin] $lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0-Production on 08-APR-2016 19:33:50Copyright (c) 1991, 2011, Oracle. All rights reserved.Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=TCP) (HOST=rh74) (PORT=1521)) STATUS of the LISTENER----Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.3.0-ProductionStart Date 08-APR-2016 19:32:48Uptime 0 days 0 hr. 1 min. 2 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File / u01/app/oracle/product/11.2.0/db_1/network/admin/listener.oraListener Log File / u01/app/oracle/diag/tnslsnr/rh74/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=rh74.cuug.cn) (PORT=1521)) (DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=EXTPROC1521) Services Summary...Service "test1" has 1 instance (s). Instance "test1", status READY, has 1 handler (s) for this service...The command completed successfully

Test the network connection:

[oracle@rh74 admin] $sqlplus system/oracle@test1

SQL*Plus: Release 11.2.0.3.0 Production on Fri Apr 8 19:34:27 2016Copyright (c) 1982, 2011, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

19:34:27 SYSTEM@ test1 >

-at this point, the database has been built successfully by hand. If you have time, you can make a cold backup for the database.

-OCM examination site exercises, follow-up to continue to launch.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report