当前位置:网站首页>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
边栏推荐
- Some reflections on preparing for the Blue Bridge Cup
- 2022-2028 global transmission type photoelectric circuit breaker industry research and trend analysis report
- Unity technical manual - color in life cycle coloroverlifetime-- speed color colorbyspeed
- 2022-2028 global industrial TFT LCD industry survey and trend analysis report
- ES6 -- 形参设置初始值、拓展运算符、迭代器、生成函数
- 2022-2028 global RBI platform industry research and trend analysis report
- Mysql database index
- Flutter 網絡請求封裝之Dio(Cookie管理、添加攔截器、下載文件、异常處理、取消請求等)
- Dio encapsulated by the flutter network request (cookie management, adding interceptors, downloading files, exception handling, canceling requests, etc.)
- 实战:typora里面如何快捷改变字体颜色(博客分享-完美)-2022.6.25(已解决)
猜你喜欢

Tiger Dao VC products are officially launched, a powerful supplement to seektiger ecology

NRM source switching tool

Canoe: the fifth simulation project: simulation + test

Which PHP open source works deserve attention

Network security project questions of the first Henan vocational skills competition in 2022

Talk about adapter mode

民航局:到 2025 年我国将初步建成安全、智慧、高效和绿色的航空物流体系

再突破!阿里云进入Gartner云AI开发者服务挑战者象限

Privatization lightweight continuous integration deployment scheme -- 03 deployment of Web services (Part 2)

2022-2028 global SiC igniter industry research and trend analysis report
随机推荐
GStreamer initialization and plugin registry procedures
How to disable the optical drive
Travel notes of 2022giao
Glory launched the points mall to support the exchange of various glory products
Equivalence class, boundary value, application method and application scenario of scenario method
2022-2028 global transmission type photoelectric circuit breaker industry research and trend analysis report
万亿热钱砸向太空经济,真的是一门好生意?
Unity技术手册 - 生命周期内颜色ColorOverLifetime--速度颜色ColorBySpeed
Mysql database index
String deformation (string case switching and realization)
使用EAST ocr遇到的坑解决方法(编译lanms)
2022年河南省第一届职业技能大赛网络安全项目试题
Unity technical manual - color in life cycle coloroverlifetime-- speed color colorbyspeed
提问的智慧?如何提问?
Analysis report on demand and investment forecast of global and Chinese flame retardant hydraulic oil market from 2022 to 2028
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 RBI platform industry research and trend analysis report
22 years of a doctor in Huawei
oracle -- 表操作
Global and Chinese flame retardant ABS industry development trend and market demand analysis report 2022 ~ 2028