当前位置:网站首页>Oracle - getting started
Oracle - getting started
2022-06-25 23:03:00 【Climbing procedural ape】
Silent installation
Environmental Science :
Linux : RedHat 7.6(3.10.0-957.el7.x86_64)
Oracle:19C Oracle Database 19c Download for Linux x86-64( Using stand-alone , download rpm Bag can )
Installation steps :
Not intended to learn oracle Best practices for installation and configuration , So refer to the great God's blog , Fast installation oracle19C redhat install OracleDataBase-19c
notes :
(1)oracle You need an account number , The computer can't be turned on , Send it to your cell phone , Register quickly , You can download
After installation , Background process view
(2) uninstall oracle
uninstall rpm package rpm -e oracle-database-ee-19c-1.0-1.x86_64 oracle-database-preinstall-19c-1.0-3.el7.x86_64
Delete oralce Configuration directory rm -rf /opt/oracle/*
Architecture and concepts
oracle 19C Created by default during installation CBD, By default PDB

Architecture
database :19C(12C Small version of ) Provides CBD And PDB The concept of , installed 19C after , The default value creates a CBD, In previous versions, an instance corresponds to a database ,19C Later, it supports cloud , Support PDB, An example is implemented , Multiple databases .
example : One installation creates multiple processes , The implementation is similar to installing multiple times
Data files .dbf: The physical storage unit of data , File to store data ,
Table space : Used to manage data files , Is the logical name of one or more data files , A data file can only belong to one tablespace , It is equivalent to dividing the entire database into many areas , Divided into segments > District > Data blocks > Disk block
user : Users create tables , After logging in, you can only see the user's table , A table space can correspond to multiple table spaces
Configure remote connection
Connect to CBD
sqlplus Log in to the server's local database
sqlplus / as sysdba
See which users
select username from dba_users;

View the current user
show user;

modify sys User's password
alter user sys identified by 'hsf123456#';
notes : Cannot start with a number , Must contain alphanumeric and special characters
Navicat To configure
The service name is SID, Connection mode selection Basic, High level image selection as a character SYSDBA, Test connection successful


Just connected oracle Yes, after ,navicat All users are displayed

Connect to PDB
(1)sqlplus Log in and check cbd And pdb
sqlplus / as sysdba The default connection is cbd, Created by default PDB yes ORACLEPDB1

(2) Get into oraclePDB1, And start up
alter session set container=ORCLPDB1;
startup;
(3) To configure ora
/opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora, Add the following orclpdb1 that will do
# tnsnames.ora Network Configuration File: /opt/oracle/product/19c/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCLCDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCLCDB)
)
)
orclpdb1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb1)
)
)
LISTENER_ORCLCDB =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(4) Test whether you can connect locally
tnsping orclpdb1

(5) Restart monitoring
lsnrctl stop
lsnrctl start
(6)navicat Connect
Change the service name to ora It's configured inside = The previous service name is sufficient

Case study 1 -- Water company charging system
Connecting to pdb After execution , Equivalent to the sqlplus / as sysdba, then alter To pdb After the operation .
(1) Create tablespace ( That is, create a data file ) -- Where is the current table saved , Only in SYS perhaps SYSTEM The user can create a table space
CREATE tablespace waterboss
datafile '/opt/oracle/data/waterboss.dbf'
size 1500M
autoextend on
next 10M maxsize 3000M;size Is the file size at this time , Will directly create 1.5G The file of , Longer time consuming ,next 10M Every time I grow 10M, The largest increase to 3000M

notes :drop tablespace DEMOSPACE including contents and datafiles // Delete tablespace
(2) Create user notes : Need to go to PDB
CREATE USER waterboss IDENTIFIED BY hsf123456# DEFAULT tablespace warterboss;
(3) Create table
The statement for creating a table is standard sql, No more details. , Also use Navicat After the visualization is created , Copy the CREATE TABLE statement .
CREATE TABLE "WATERBOSSFACTORY"."T_OWNERS"
( "ID" NUMBER(5,0) NOT NULL ENABLE,
"NAME" VARCHAR2(30) DEFAULT '' NOT NULL ENABLE,
"ADDRESSID" NUMBER(20,0) DEFAULT '' NOT NULL ENABLE,
"HOUSENUMBER" VARCHAR2(30) DEFAULT '' NOT NULL ENABLE,
"WATERMETER" VARCHAR2(30) DEFAULT '',
"ADDDATE" DATE NOT NULL ENABLE,
"OWNERTYPEID" NUMBER(2,0) DEFAULT '' NOT NULL ENABLE,
PRIMARY KEY ("ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
TABLESPACE "WATERBOSSFACTORY" ENABLE
) SEGMENT CREATION DEFERRED
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS LOGGING
TABLESPACE "WATERBOSSFACTORY"Basic knowledge learned
oracle data type :
Character
CHAR Fixed length character types , Maximum storage 2000 Bytes , When the stored data is not long enough , Can use spaces to complement the length ;
VARCHAR2: Variable length character types , Up to 4000 Bytes , When the length is not enough , It will not be replenished automatically .
LONG: Big text types , Maximum storable 2G
Numerical type : The length is in 1-38 Between
NuMBWER(5,2) : 5 Is represented by several digits ,2 Represents several decimal places , Maximum 999.99
NUMBER(5) : most 5 A decimal number , Maximum 99999
Date type
DATE: Date time , Accurate to s
TIMESTAMP: Accurate to the decimal point 9 position
Binary :
CLOB: Store characters , most 4 individual G
BLOB: Store sound 、 Images 、 video , most 2 individual G
basic SQL
CBD、PDB
(1)SELECT name,cdb from v$database; // View all cbd rpm Package installation defaults ORCLCDB
(2)select pdb_id,pdb_name,dbid,status,creation_scn from dba_pdbs; // View all pdb rpm install , Default ORCLCDB1
(3)show con_name; // Displays the current container name show con_id; View the of the current container id show pdbs; // Displays all of the current container pdb, It only takes effect when the root container


(3)select sys_context('userenv','con_name'),sys_context('userenv','con_id') from dual; // View containers and containers for the current session id

(4)select name,con_id,open_mode FROM v$pdbs; // see pdb Start state ,SEED It's the seed PDB, Create others according to the template PDB

(5) Sign in PDB ORACLPDB1
alter session set container=ORACLPDB1; // Switch to PDB
alter session set container=cdb$root // Switch to CBD

notes :
(1)SID Displayed instance name , Don't change it , Multi tenant instances are shared
(2) When creating tablespaces and users , Enter the first pdb Later
Table space
select tablespace_name, sum(bytes)/1024/1024 from dba_data_files group by tablespace_name; // View all tablespaces
Get into CDB Create a tablespace
CREATE tablespace waterbossFactory
datafile '/opt/oracle/data/waterbossFactory.dbf'
size 150M
autoextend on
next 10M maxsize 3000M;
user
Oracle User permissions _ indifferent ; The blog of -CSDN Blog _oracle User permissions
show user; // Check which user is currently logged in
select username from dba_users; // View all users
Get into PDB Create users after
CREATE USER waterbossFactory IDENTIFIED BY hsf123456# DEFAULT tablespace waterbossFactory;
View all users ,CBD And PDB User space is different , The query is different .

select * from tabs; // View all tables

Reference course :
Oracle 19C Handle installation tutorial II _ Bili, Bili _bilibili
边栏推荐
- ES6-- 集合
- 哪些PHP开源作品值得关注
- adb常用命令
- Record the learning record of the exists keyword once
- 腾讯《和平精英》新版本将至:新增账号安全保护系统,游戏内违规行为检测升级
- Relinearization in homomorphic encryption (ckks)
- [dynamic programming] longest palindrome substring thinking about dynamic transfer cycle sequence
- Lecture 14 of the Blue Bridge Cup -- number theory [exercises]
- Trillions of hot money smashed into the space economy. Is it really a good business?
- Dio encapsulé pour les requêtes réseau flutter (gestion des cookies, ajout d'intercepteurs, téléchargement de fichiers, gestion des exceptions, annulation des requêtes, etc.)
猜你喜欢
![[eosio] eos/wax signature error is_ Canonical (c): signature is not canonical](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[eosio] eos/wax signature error is_ Canonical (c): signature is not canonical
2、一个向量乘它的转置,其几何意义是什么?

Another breakthrough! Alibaba cloud enters the Gartner cloud AI developer service Challenger quadrant

如何用jmeter做接口测试

Unity的Ping类使用

Obsidian basic tutorial

Talk about adapter mode

Glory launched the points mall to support the exchange of various glory products

万亿热钱砸向太空经济,真的是一门好生意?

Record the learning record of the exists keyword once
随机推荐
New network security competition of the secondary vocational group in 2022
2022-2028 global proton exchange membrane hydrogen electrolyzer industry survey and trend analysis report
Multi modal data can also be Mae? Berkeley & Google proposed m3ae to conduct Mae on image and text data! The optimal masking rate can reach 75%, significantly higher than 15% of Bert
2022-2028 global industrial touch screen industry research and trend analysis report
民航局:到 2025 年我国将初步建成安全、智慧、高效和绿色的航空物流体系
Unity技术手册 - 粒子发射和生命周期内速度子模块
Some points to pay attention to when closing mongodb services (as well as related commands when opening)
[dynamic programming] longest palindrome substring thinking about dynamic transfer cycle sequence
华为云SRE确定性运维专刊(第一期)
2022 love analysis · panoramic report of it operation and maintenance manufacturers
小程序绘制一个简单的饼图
ES6-- 模板字符串、对象的简化写法、箭头函数
Travel notes of 2022giao
APP-新功能上线
Ribbon core ⼼ source code analysis
How to use the find command
Raspberry PI (bullseye) replacement method of Alibaba cloud source
Unity的Ping类使用
2022-2028 global vacuum jacket system industry survey and trend analysis report
[WPF] XAML code skills that can be directly used for converting CAD engineering drawings to WPF