柚子快報(bào)激活碼778899分享:數(shù)據(jù)庫 Oracle 基礎(chǔ)知識
柚子快報(bào)激活碼778899分享:數(shù)據(jù)庫 Oracle 基礎(chǔ)知識
Oracle 基礎(chǔ)
Disk Layout
$ORACLE_BASE
Before we can install any Oracle software, we need to have a base location. This location is called the Oracle Base, and many times on Unix and Linux environments, the $ORACLE_BASE environment variable is explicitly defined to this location. The OFA guidelines suggests that ORACLE_BASE be located at /u01/app/oracle on Unix and Linux machines. On Windows, ORACLE_BASE is often located in the C:\oracle directory.
The Oracle Base is the root of the Oracle software and its log files. The Oracle database software will be installed in a subdirectory of the base. Oracle keeps an internal inventory of the Oracle software and its patches in $ORACLE_BASE/oraInventory. Oracle database files can be a subdirectory of the base as well.
$ORACLE_HOME
It is possible to have more than one Oracle database on a single server, each with a different Oracle version. The biggest, but not sole, benefit of OFA today is to help facilitate different Oracle versions on the same server. With OFA, you can easily install the Oracle 11.2.0.4, 12.1.0.2, and 12.2.0.1 versions and have no conflicts.
Oracle handles each version independently by installing it in its own home directory, called $ORACLE_HOME (%ORACLE_HOME% on Windows). The OFA guidelines place $ORACLE_HOME in a folder with a naming scheme similar to $ORACLE_BASE/product/version/type, where version denotes the Oracle version installed and where type is typically dbhome_X for database software, client_X for Oracle Client software, or grid_X for Oracle’s Grid Infrastructure. Here are some examples of ORACLE_HOME directories:
/u01/app/oracle/product/11.2.0/dbhome_1/u01/app/oracle/product/11.2.0/dbhome_2/u01/app/oracle/product/12.1.0/dbhome_1/u01/app/oracle/product/12.1.0/dbhome_2
Database Files
The OFA guidelines suggest that we store database files in $ORACLE_BASE/oradata/db_name as a starting point. If your database is for anything other than a testbed, the disk for ORACLE_BASE may not be large enough to store all of the files. It is very common for the DBA to separate database files to different disk locations, for a number of reasons. They may need multiple disk units because one disk unit is not large enough. They may want multiple disk units so that highly active database files can be segregated to reduce disk contention.
If more than one disk is being used, they are typically mounted to the Unix or Linux server similar to the following example:
/u01/app/oracle/oradata/orcl/data01/u01/app/oracle/oradata/orcl/data02
The database name is orcl in the example above. It should be noted that data01 and data02 are different disk units with different mount points. On Unix/Linux, they look to be subdirectories off the same disk, but they are not. Your organization may use a different directory structure for the Oracle disk, which is perfectly acceptable. Again, just be consistent across the enterprise.
There is one more OFA guideline pertaining to database files, and that addresses the name of the file itself. The OFA guideline suggests that we name control files controlXX.ctl, name online redo logs redoXX.log, and name database files tablespace_nameXX.dbf, where XX is a sequential number. So, for example, I might have three control files with names control01.ctl, control02.ctl, and control03.ctl. Online redo logs would be named redo01.log, redo02.log, and redo03.log. Database files for the SYSTEM and SYSAUX tablespaces are usually named system01.dbf and sysaux01.dbf respectively. An application data tablespace with multiple files might have files named app_data01.dbf and app_data02.dbf as an example.
Directory PathContents/u01/app/oracleORACLE_BASE/u01/app/oracle/oralnventoryOracle Inventory/u01/app/oracle/product/12.2.0.1ORACLE_HOME/u01/app/oracle/adminAdmin files/u01/app/oracle/diag/rdbms/orcl/orclDiagnostic files/u01/app/oracle/oradata/orclDatabase files
基本使用
命令行配置
[root@node01 ~]# yum install -y rlwrap
[oracle@node01 ~]$ alias sqlplus='rlwrap sqlplus'
如何啟動(dòng)數(shù)據(jù)庫:
第一步啟動(dòng)監(jiān)聽:
# 1. 啟動(dòng)監(jiān)聽
[oracle@node01 ~]$ lsnrctl start
第二步登錄到數(shù)據(jù)庫:
# 2. 登錄數(shù)據(jù)庫
[oracle@node01 ~]$ sqlplus /nolog
第三步:
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jul 10 10:15:48 2024
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
-- 連接到 sysdba
SQL> conn / as sysdba
Connected to an idle instance.
-- 執(zhí)行 startup 命令
SQL>startup
ORACLE instance started.
Total System Global Area 1845491624 bytes
Fixed Size 9136040 bytes
Variable Size 436207616 bytes
Database Buffers 1392508928 bytes
Redo Buffers 7639040 bytes
Database mounted.
Database opened.
柚子快報(bào)激活碼778899分享:數(shù)據(jù)庫 Oracle 基礎(chǔ)知識
相關(guān)文章
本文內(nèi)容根據(jù)網(wǎng)絡(luò)資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點(diǎn)和立場。
轉(zhuǎn)載請注明,如有侵權(quán),聯(lián)系刪除。