This commit is contained in:
wenyongda 2024-03-15 16:37:59 +08:00
parent 5b98c2e31a
commit 4a589d74d2
4 changed files with 203 additions and 20 deletions

View File

@ -0,0 +1,5 @@
---
title: Kendo UI
date: 2024-03-08 11:06:51
tags:
---

View File

@ -627,7 +627,7 @@ error: Failed dependencies:
libssl.so.10()(64bit) is needed by mysql-community-libs-compat-5.7.41-1.el7.x86_64
libssl.so.10(libssl.so.10)(64bit) is needed by mysql-community-libs-compat-5.7.41-1.el7.x86_64
# 执行
dnf install -y https://repo.almalinux.org/almalinux/8/AppStream/x86_64/os/Packages/compat-openssl10-1.0.2o-4.el8_6.x86_64.rpm
dnf install -y https://repo.almalinux.org/almalinux/8/AppStream/x86_64/os/Packages/compat-openssl10-1.0.2o-4.el8_6.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.41-1.el7.x86_64.rpm
# 如果出现以下错误

View File

@ -205,6 +205,10 @@ Grant succeeded.
### Windows下安装
## Oracle SQL Developer
### 设置自动提示
@ -302,15 +306,19 @@ alter user sys identified by 123456;
## CDB 和 PDB
- CDB :容器数据库,名称为 CDB$ROOT。其作用就是系统数据库sys等账号都保存在里面。同时它可以管理PDB数据库
![24221659-693602e2df62491e8cad466d5b865147](D:\source\repos\XiaodaBlogSource\source\_posts\Oracle\24221659-693602e2df62491e8cad466d5b865147.gif)
- CDB :容器数据库,名称为 CDB$ROOT。其作用就是系统数据库sys账号等以及Common User(公共用户)都保存在里面。同时它可以管理PDB数据库
- PDB 可插拔的数据库。用户可以在PDB自建数据库
- Oracle安装成功后有个默认的pdb数据库在安装Oracle的时候自己设定
- PDB中自带有PDB$SEED属于PDB的模板数据库自己创建数据库的时候以此库为模板
- PDB中自带有PDB$SEED属于PDB的模板数据库自己创建数据库的时候以此库为模板,非常类似 SQL Server 中的 model 数据库
命令如何查看当前的位置是CDB还是PDB使用sys登录输入命令
```she
create pluggable database pdb1 admin user pdb1 identified by 1 file_name_convert=('/opt/oracle/oradata/ORCLCDB/pdbseed','/opt/oracle/oradata/ORCLCDB/pdb1'); -- 创建PDB其中pdb1是我创建的可插接式数据库pdb1是创建的用户1是密码。file_name_convert是对应目录
show con_name; -- 查看当前所在容器位置
show pdbs; -- 查看所有的PDB
@ -373,6 +381,70 @@ select distinct t.privilege
![image-20240229151409259](Oracle/image-20240229151409259.png)
### 语法
```sql
-- 表空间类型及名称,默认不指定类型(永久)
create [temporary | undo] tablespace "TBS"
-- 数据文件的位置及大小
datafile 'D:\Oracle\TBS.dbf' size 10m
-- 是否自动扩展,默认 'off'
[autoextend off] | [autoextend on next n maxsize m]
-- 是否产生日志,默认 'logging'
[logging | nologging]
-- 段空间自动管理,默认 'auto' 推荐
[segment space management auto]
-- 表空间管理方式dictionary | local(默认,推荐)
[extent management local [uniform size n]]
```
- **创建一个永久表空间 “TBS01”其大小为 10MB**
```sql
create tablespace "TBS01"
datafile 'D:\Oracle\TBS01.dbf' size 10m;
-- 1.路径必须存在,否则报错!
-- 2.表空间名称默认大写,除非用引号注明,如 "tbs" 则为小写
```
- **创建一个自增表空间 “TBS02”其大小为 10MB每次扩展 1MB最大扩展到 20MB**
```sql
create tablespace "TBS02"
datafile 'D:\Oracle\TBS02.dbf' size 10m
autoextend on next 1m maxsize 20m;
```
- **每个用户都有一个默认临时表空间在创建用户时如果没指定将使用oracle 数据库设置的默认临时表空间,查询方法是:**
```sql
select property_name,property_value from database_properties where property_value=TEMP
```
### 新建
```sql
CREATE TABLESPACE ACTERP_BD_DEV
LOGGING
DATAFILE
'/u01/app/oracle/oradata/orcl/acterp_bd_dev.dbf' SIZE 2048m AUTOEXTEND ON NEXT 50m MAXSIZE 20480m
EXTENT MANAGEMENT LOCAL;
-- 临时表空间
CREATE TEMPORARY TABLESPACE ACTERP_BD_DEV_TEMP
TEMPFILE
'/u01/app/oracle/oradata/orcl/acterp_bd_dev_temp.dbf' SIZE 2048m AUTOEXTEND ON NEXT 50m MAXSIZE 20480m
EXTENT MANAGEMENT LOCAL;
```
### 查询
```sql
-- 查询表空间及对应数据文件
select tablespace_name,file_id,bytes/1024/1024,file_name from dba_data_files order by file_id;
```
### 修改
```sql
@ -391,6 +463,103 @@ size 200m;
```
### 删除
```sql
drop user acterp_pre cascade;
drop tablespace acterp_pre including contents and datafiles cascade constraint;
drop tablespace acterp_pre_temp including contents and datafiles cascade constraint;
```
## 用户
### 操作
#### cdb
##### 新建
```sql
CREATE TABLESPACE ACT_DEV
DATAFILE
'/opt/oracle/oradata/ORCLCDB/act_dev.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
create user C##act_dev identified by 123456 default tablespace ACT_DEV;
grant dba,connect to C##act_dev;
commit;
```
##### 删除
```sql
drop user pdb1 cascade;
#cascade 删除pdb1这个用户的同时级联删除 pdb1 用户下的所有数据对象如table等
```
修改用户密码
```sql
alter user pdb1 identified by 1;
```
#### pdb
```sql
# 首先切换到pdb
alter session set container=ORCLPDB1; -- cdb切换到ORCLPDB1
# 创建用户名为 pdb1 密码为 1 的用户
create user pdb1 identified by 1;
grant create session to pdb1;
grant create table to pdb1;
grant create tablespace to pdb1;
grant create view to pdb1;
grant connect,resource to pdb1;
grant dba to pdb1;
```
#### non-cdb
```sql
-- 查看表空间及数据文件使用
select tablespace_name,file_id,bytes/1024/1024,file_name from dba_data_files order by file_id;
CREATE TABLESPACE ACTERP_PRE
LOGGING
DATAFILE
'D:\APP\ORACLE\ORADATA\ORCL\acterp_pre.dbf' SIZE 2048m AUTOEXTEND ON NEXT 50m MAXSIZE 20480m
EXTENT MANAGEMENT LOCAL;
CREATE TEMPORARY TABLESPACE ACTERP_PRE_TEMP
TEMPFILE
'D:\APP\ORACLE\ORADATA\ORCL\acterp_pre_temp.dbf' SIZE 2048m AUTOEXTEND ON NEXT 50m MAXSIZE 20480m
EXTENT MANAGEMENT LOCAL;
create user acterp_pre identified by 1 default tablespace ACTERP_PRE temporary tablespace ACTERP_PRE_TEMP;
grant create session to acterp_pre;
grant create table to acterp_pre;
grant create tablespace to acterp_pre;
grant create view to acterp_pre;
grant connect,resource to acterp_pre;
grant dba to acterp_pre;
commit;
```
## 语法
@ -405,23 +574,6 @@ CREATE TABLESPACE ACT_DEV
EXTENT MANAGEMENT LOCAL;
```
### 新建用户
```shell
# cdb下
CREATE TABLESPACE ACT_DEV
DATAFILE
'/opt/oracle/oradata/ORCLCDB/act_dev.dbf' SIZE 100M AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED LOGGING EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
create user C##act_dev identified by 123456 default tablespace ACT_DEV;
grant dba,connect to C##act_dev;
commit;
```
### 解除占用
```sql
@ -471,7 +623,33 @@ INSERT INTO table1(ID,NAME,TEXT) SELECT SYS_GUID(), t2.NAME, t3.TEXT FROM DUAL,
```
### directory目录
```sql
-- 查询directory目录
select * from dba_directories;
-- 创建或者修改 directory目录
create or replace directory dum_date_dir as '/home/oracle/datatmp'
-- 赋权 directory目录
ant read,write on directory dumpdir to username;
-- 删除directory目录
drop directory DIRENAME;
```
## 数据泵
10g开始引入了数据泵(Data Dump)技术可以快速将数据库元数据和数据快速移动到另一个oracle数据库中
### 导入 impdp
```shell
impdp acterp_bd_dev/1@ORCLCDB REMAP_SCHEMA = acterp_bd_dev:acterp_bd_dev table_exists_action = replace directory=data_pump_dir dumpfile=acterp_bd_dev.dmp logfile=impdp_acterp_bd_dev.log
```
如果是`non-cdb`需去掉`@SID`
## 内连接与外连接

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB