当前位置:网站首页>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
边栏推荐
- How to use the find command
- 记|一次exists关键字的学习记录
- Data governance is easier said than done
- 【EOSIO】EOS/WAX签名错误 is_canonical( c ): signature is not canonical 问题
- ES6 -- 形参设置初始值、拓展运算符、迭代器、生成函数
- The wisdom of questioning? How to ask questions?
- 2022-2028 global cloud based remote browser isolation industry research and trend analysis report
- What are the channels for Internet advertising to gain customers?
- Facing the "industry, University and research" gap in AI talent training, how can shengteng AI enrich the black land of industrial talents?
- Ribbon core ⼼ source code analysis
猜你喜欢

Nacos source code analysis 01 code structure

Pit resolution encountered using East OCR (compile LAMS)

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

Wpewebkit debugging MSE playback
![[WPF] XAML code skills that can be directly used for converting CAD engineering drawings to WPF](/img/a1/09d2dc0ec47c54530da4d42d218d1c.jpg)
[WPF] XAML code skills that can be directly used for converting CAD engineering drawings to WPF
[email protected]@COLLATION_CONNECTION */"/>.sql数据库导入错误:/*!40101 SET @[email protected]@COLLATION_CONNECTION */

2022-2028 global carbon fiber unidirectional tape industry research and trend analysis report

Fastjson反序列化随机性失败

多模态数据也能进行MAE?伯克利&谷歌提出M3AE,在图像和文本数据上进行MAE!最优掩蔽率可达75%,显著高于BERT的15%...

小程序绘制一个简单的饼图
随机推荐
1281_ FreeRTOS_ Implementation analysis of vtaskdelayuntil
Development trend of China's power carrier communication industry and Research Report on the 14th five year plan 2022 ~ 2028
Equivalence class, boundary value, application method and application scenario of scenario method
1281_FreeRTOS_vTaskDelayUntil实现分析
What do l and R of earphone mean?
ES6 --- 数值扩展、对象拓展
Why absolute positioning overlaps
Unity technical manual - life cycle rotation rotationoverlifetime- speed rotation rotationbyspeed- and external forces
Travel notes of 2022giao
Trillions of hot money smashed into the space economy. Is it really a good business?
Openwrt (VIII) application layer development
Exclusive or operator simple logic operation a^=b
多模态数据也能进行MAE?伯克利&谷歌提出M3AE,在图像和文本数据上进行MAE!最优掩蔽率可达75%,显著高于BERT的15%...
[invitation letter] on March 4, the platform enabled digital intelligence Innovation -- UFIDA BiP PAAS cloud platform IUAP digital intelligence hundred cities forum · Jinan Station
Hello, teacher, is it really safe to open an account in Alipay fund?
Intimacy - [comfortable exit] - final communication to reduce injury
Why can't the mobile phone be used and the computer be connected
2022-2028 global co extrusion production line industry research and trend analysis report
【EOSIO】EOS/WAX签名错误 is_canonical( c ): signature is not canonical 问题
How to use JMeter for interface testing