当前位置:网站首页>Configuration of oracle19c under alicloud lightweight application server linux-centos7
Configuration of oracle19c under alicloud lightweight application server linux-centos7
2022-06-21 13:45:00 【testleaf】
Initial environment : Alicloud lightweight application server has been installed Oracle19c
Specific goals : To configure Oracle Database 19c
Catalog
- First step : Switch to Oracle Command line
- The second step : Create new users and tablespaces
- The third step : Switching users
- Step four : Create some tables under the current user
- Step five : Add some data to the table just now
- Step six : Download the latest version instantclient
- Step seven :Navicat To configure
First step : Switch to Oracle Command line
1. modify root User password , Remember this step , Otherwise you will regret .
Carry out orders passwd , Type twice 123456, That's all right. .
2. Switch to oracle Under the user , Carry out orders su - oracle:
3. Check the listening status , Carry out orders lsnrctl status:
Monitor start , Carry out orders lsnrctl start:
Monitor off , Carry out orders lsnrctl stop;
4. Sign in oracle database , Carry out orders sqlplus / as sysdba.
The second step : Create new users and tablespaces
1. Boot instance , Carry out orders startup:
Close instance , Carry out orders shutdown;
tips: If startup Report a mistake later ORA-01012: not logged on;
sqlplus / as sysdba
shutdonwn abort
source :https://www.cnblogs.com/kerrycode/p/4244493.html
2. Create a temporary table space :
-- Query the absolute path of the temporary tablespace file . If necessary , You can write an absolute path through a query . It's usually used ${ORACLE_HOME} That's all right.
select name from v$tempfile;
create temporary tablespace TESTLEAF_TEMP tempfile '${ORACLE_HOME}\oradata\TESTLEAF_TEMP.bdf' size 100m reuse autoextend on next 20m maxsize unlimited;

3. Create formal tablespaces :
-- Query the absolute path of user tablespace file :
select name from v$datafile;
create tablespace TESTLEAF datafile '${ORACLE_HOME}\oradata\TESTLEAF.dbf' size 100M reuse autoextend on next 40M maxsize unlimited default storage(initial 128k next 128k minextents 2 maxextents unlimited);

4. Create users and passwords , Specify the temporary tablespace and tablespace created above ( When creating a user, the user name should be C## At the beginning , Prevent prompting that the user name is invalid ):
create user C##TESTLEAF identified by 123456 default tablespace TESTLEAF temporary tablespace TESTLEAF_TEMP;

tips:
Compared with oracle11g,oracle19c One more. CDB and PDB The concept of ( from 12C Begin to appear )
https://www.it610.com/article/1280868824853266432.htm
5. Modify the user name
Query the number of the user name to be modified :
select user#,name from user$;

( Take the corresponding user#, here user# be equal to 113)
Change user name :
update user$ set name='TESTLEAF' where user#=113;

6. solve Oracle After modifying the user name , Change the user password again , Will be submitted to the ‘ The user could not be found ’ The problem of :
ALTER SYSTEM FLUSH SHARED_POOL;

7. Change the password corresponding to the user :
ALTER USER TESTLEAF IDENTIFIED BY 123456;

8. User empowerment :
grant dba to TESTLEAF;
grant connect,resource to TESTLEAF;
grant select any table to TESTLEAF;
grant delete any table to TESTLEAF;
grant update any table to TESTLEAF;
grant insert any table to TESTLEAF;
# Permissions to manipulate tablespaces
grant unlimited tablespace to TESTLEAF;


9. View all user permissions :
select * from dba_sys_privs where grantee = 'TESTLEAF';
select * from dba_role_privs where grantee = 'TESTLEAF';
The third step : Switching users
1. Switch to the user you just created ( user name + password ):
conn TESTLEAF/123456;
2. Check the current user :
show user;

Step four : Create some tables under the current user
1. Create table Customers
CREATE TABLE Customers
(
cust_id char(10) NOT NULL ,
cust_name char(50) NOT NULL ,
cust_address char(50) NULL ,
cust_city char(50) NULL ,
cust_state char(5) NULL ,
cust_zip char(10) NULL ,
cust_country char(50) NULL ,
cust_contact char(50) NULL ,
cust_email char(255) NULL
);
2. Create table OrderItems
CREATE TABLE OrderItems
(
order_num int NOT NULL ,
order_item int NOT NULL ,
prod_id char(10) NOT NULL ,
quantity int NOT NULL ,
item_price decimal(8,2) NOT NULL
);
3. Create table Orders
CREATE TABLE Orders
(
order_num int NOT NULL ,
order_date date NOT NULL ,
cust_id char(10) NOT NULL
);
4. Create table Products
CREATE TABLE Products
(
prod_id char(10) NOT NULL ,
vend_id char(10) NOT NULL ,
prod_name char(255) NOT NULL ,
prod_price decimal(8,2) NOT NULL ,
prod_desc varchar(1000) NULL
);
5. Create table Vendors
CREATE TABLE Vendors
(
vend_id char(10) NOT NULL ,
vend_name char(50) NOT NULL ,
vend_address char(50) NULL ,
vend_city char(50) NULL ,
vend_state char(5) NULL ,
vend_zip char(10) NULL ,
vend_country char(50) NULL
);
6. Define the primary key
ALTER TABLE Customers ADD CONSTRAINT PK_Customers PRIMARY KEY (cust_id);
ALTER TABLE OrderItems ADD CONSTRAINT PK_OrderItems PRIMARY KEY (order_num, order_item);
ALTER TABLE Orders ADD CONSTRAINT PK_Orders PRIMARY KEY (order_num);
ALTER TABLE Products ADD CONSTRAINT PK_Products PRIMARY KEY (prod_id);
ALTER TABLE Vendors ADD CONSTRAINT PK_Vendors PRIMARY KEY (vend_id);
7. Defining foreign keys
ALTER TABLE OrderItems
ADD CONSTRAINT FK_OrderItems_Orders FOREIGN KEY (order_num) REFERENCES Orders (order_num);
ALTER TABLE OrderItems
ADD CONSTRAINT FK_OrderItems_Products FOREIGN KEY (prod_id) REFERENCES Products (prod_id);
ALTER TABLE Orders
ADD CONSTRAINT FK_Orders_Customers FOREIGN KEY (cust_id) REFERENCES Customers (cust_id);
ALTER TABLE Products
ADD CONSTRAINT FK_Products_Vendors FOREIGN KEY (vend_id) REFERENCES Vendors (vend_id);
Step five : Add some data to the table just now
1. Give table Customers Add data
INSERT INTO Customers(cust_id, cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact, cust_email)
VALUES('1000000001', 'Village Toys', '200 Maple Lane', 'Detroit', 'MI', '44444', 'USA', 'John Smith', '[email protected]');
INSERT INTO Customers(cust_id, cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact)
VALUES('1000000002', 'Kids Place', '333 South Lake Drive', 'Columbus', 'OH', '43333', 'USA', 'Michelle Green');
INSERT INTO Customers(cust_id, cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact, cust_email)
VALUES('1000000003', 'Fun4All', '1 Sunny Place', 'Muncie', 'IN', '42222', 'USA', 'Jim Jones', '[email protected]');
INSERT INTO Customers(cust_id, cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact, cust_email)
VALUES('1000000004', 'Fun4All', '829 Riverside Drive', 'Phoenix', 'AZ', '88888', 'USA', 'Denise L. Stephens', '[email protected]');
INSERT INTO Customers(cust_id, cust_name, cust_address, cust_city, cust_state, cust_zip, cust_country, cust_contact)
VALUES('1000000005', 'The Toy Store', '4545 53rd Street', 'Chicago', 'IL', '54545', 'USA', 'Kim Howard');
2. Give table Vendors Add data
INSERT INTO Vendors(vend_id, vend_name, vend_address, vend_city, vend_state, vend_zip, vend_country)
VALUES('BRS01','Bears R Us','123 Main Street','Bear Town','MI','44444', 'USA');
INSERT INTO Vendors(vend_id, vend_name, vend_address, vend_city, vend_state, vend_zip, vend_country)
VALUES('BRE02','Bear Emporium','500 Park Street','Anytown','OH','44333', 'USA');
INSERT INTO Vendors(vend_id, vend_name, vend_address, vend_city, vend_state, vend_zip, vend_country)
VALUES('DLL01','Doll House Inc.','555 High Street','Dollsville','CA','99999', 'USA');
INSERT INTO Vendors(vend_id, vend_name, vend_address, vend_city, vend_state, vend_zip, vend_country)
VALUES('FRB01','Furball Inc.','1000 5th Avenue','New York','NY','11111', 'USA');
INSERT INTO Vendors(vend_id, vend_name, vend_address, vend_city, vend_state, vend_zip, vend_country)
VALUES('FNG01','Fun and Games','42 Galaxy Road','London', NULL,'N16 6PS', 'England');
INSERT INTO Vendors(vend_id, vend_name, vend_address, vend_city, vend_state, vend_zip, vend_country)
VALUES('JTS01','Jouets et ours','1 Rue Amusement','Paris', NULL,'45678', 'France');
3. Give table Products Add data
INSERT INTO Products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES('BR01', 'BRS01', '8 inch teddy bear', 5.99, '8 inch teddy bear, comes with cap and jacket');
INSERT INTO Products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES('BR02', 'BRS01', '12 inch teddy bear', 8.99, '12 inch teddy bear, comes with cap and jacket');
INSERT INTO Products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES('BR03', 'BRS01', '18 inch teddy bear', 11.99, '18 inch teddy bear, comes with cap and jacket');
INSERT INTO Products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES('BNBG01', 'DLL01', 'Fish bean bag toy', 3.49, 'Fish bean bag toy, complete with bean bag worms with which to feed it');
INSERT INTO Products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES('BNBG02', 'DLL01', 'Bird bean bag toy', 3.49, 'Bird bean bag toy, eggs are not included');
INSERT INTO Products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES('BNBG03', 'DLL01', 'Rabbit bean bag toy', 3.49, 'Rabbit bean bag toy, comes with bean bag carrots');
INSERT INTO Products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES('RGAN01', 'DLL01', 'Raggedy Ann', 4.99, '18 inch Raggedy Ann doll');
INSERT INTO Products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES('RYL01', 'FNG01', 'King doll', 9.49, '12 inch king doll with royal garments and crown');
INSERT INTO Products(prod_id, vend_id, prod_name, prod_price, prod_desc)
VALUES('RYL02', 'FNG01', 'Queen doll', 9.49, '12 inch queen doll with royal garments and crown');
4. Give table Orders Add data
INSERT INTO Orders(order_num, order_date, cust_id)
VALUES(20005, TO_DATE('2012-05-01', 'yyyy-mm-dd'), '1000000001');
INSERT INTO Orders(order_num, order_date, cust_id)
VALUES(20006, TO_DATE('2012-01-12', 'yyyy-mm-dd'), '1000000003');
INSERT INTO Orders(order_num, order_date, cust_id)
VALUES(20007, TO_DATE('2012-01-30', 'yyyy-mm-dd'), '1000000004');
INSERT INTO Orders(order_num, order_date, cust_id)
VALUES(20008, TO_DATE('2012-02-03', 'yyyy-mm-dd'), '1000000005');
INSERT INTO Orders(order_num, order_date, cust_id)
VALUES(20009, TO_DATE('2012-02-08', 'yyyy-mm-dd'), '1000000001');
5. Give table OrderItems Add data
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20005, 1, 'BR01', 100, 5.49);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20005, 2, 'BR03', 100, 10.99);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20006, 1, 'BR01', 20, 5.99);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20006, 2, 'BR02', 10, 8.99);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20006, 3, 'BR03', 10, 11.99);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20007, 1, 'BR03', 50, 11.49);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20007, 2, 'BNBG01', 100, 2.99);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20007, 3, 'BNBG02', 100, 2.99);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20007, 4, 'BNBG03', 100, 2.99);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20007, 5, 'RGAN01', 50, 4.49);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20008, 1, 'RGAN01', 5, 4.99);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20008, 2, 'BR03', 5, 11.99);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20008, 3, 'BNBG01', 10, 3.49);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20008, 4, 'BNBG02', 10, 3.49);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20008, 5, 'BNBG03', 10, 3.49);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20009, 1, 'BNBG01', 250, 2.49);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20009, 2, 'BNBG02', 250, 2.49);
INSERT INTO OrderItems(order_num, order_item, prod_id, quantity, item_price)
VALUES(20009, 3, 'BNBG03', 250, 2.49);
6. Submit operation
commit;
Step six : Download the latest version instantclient
1. because Oracle Slow download on official website , So the following Baidu SkyDrive link is provided .
link : https://pan.baidu.com/s/1CWR5ka5z7WDZ91iM0UsUMg Extraction code : leaf
Interested partners can also follow the following methods in Oracle Download on the official website .
2. Open the web site :https://www.oracle.com/database/technologies/instant-client.html
3. Click on “Download”:
4. Click on “Instant Client for Microsoft Windows (x64)”:
5. Click download in turn :Basic Package、SQL*Plus Package、SDK Package;


6. Download and unzip , Put it in the same folder 
Step seven :Navicat To configure
1. open Navicat, Click on “ Tools ”》“ Options ”:
2. Click on “ Environmental Science ”, Select the folder you just downloaded sqlplus.exe Document and oci.dll file , Click on “ determine ”, And restart Navicat, In this way Navicat You can be right in Oracle Database usage sqlplus Command line interface .
3. Alibaba cloud firewall added 1521 port 

Otherwise, the following mistakes will occur :ORA-12170
4. Service name query
Enter the query statement in the database ,
select global_name from global_name;
I am here ORCLCDB, Remember this .
5.Navicat Create a new connection using the user you just created 
6. Find the same tablespace as the user name , You can see the five tables just created , The data is the same ;
disclaimer :
1. The purpose of writing this article is to learn better Oracle Configuration of , If the interests of the people concerned are harmed , Please contact to delete ;
2. If the description is not right , Please correct in the comments ;
3. Writing is not easy , If it feels useful , Like collection will make bloggers happy ;
4. Besides , This article supports any form of reprint , Reprint please indicate the source , Thank you very much !!!
This article comes from :https://blog.csdn.net/testleaf/article/details/109096654
Blog Garden cnblogs Same number .
边栏推荐
猜你喜欢

Web3.js connection to metamask wallet transfer

Open source FTP server FileZilla server

Set up ZABBIX monitoring and email alarm

seaborn数据总体分布的可视化策略

Highly available configuration of database (MySQL)
![[deeply understand tcapulusdb technology] tcapulusdb import data](/img/bd/999a0d2020f68b3bcee6b617328dfc.png)
[deeply understand tcapulusdb technology] tcapulusdb import data

MySQL - adding, deleting, querying and modifying tables

Kubernetes' fast practice and core principle analysis

Declare war on uncivilized code I

Are you still using generator to generate crud code of XXX management system? Let's see what I wrote
随机推荐
. Net synchronization mechanism and application examples
4. procedure flow structure
Lamp architecture 4 -- MySQL source code compilation and use
Prepare for the golden three silver four, are you ready? Summary of software test interview questions
Consultation: what kind of securities company is micro securities? Is it safe to open an account?
8. structure
Design and implementation of object system in redis
Web3.js connection to metamask wallet transfer
咨询:微证券是什么证券公司,开户安全吗?
MySQL - built in functions
如何使用搜索引擎?
Test the interface between app and wechat applet
Heat mapping using Seaborn
6. functions
Application configuration management, basic principle analysis
基于STM32电压检测和电流检测
Kotlin - i/o flow
Atom的一些操作
Lamp Architecture 3 -- compilation and use of PHP source code
Detailed explanation and examples of common parameters of curl