当前位置:网站首页>【Oracle 数据库】奶妈式教程day02 数据库管理工具SQLPLUS的使用
【Oracle 数据库】奶妈式教程day02 数据库管理工具SQLPLUS的使用
2022-06-11 07:22:00 【菜鸟进阶站】
SQLPLUS的使用
安装完Oracle 11G,在开始菜单中会产生Oracle自带的管理工具,其中就包括SQL Plus。
SQL Plus的登录
1. 打开Oracle自带的SQL Plus插件
win+r 输入cmd敲回车

2. 以管理员身份登录SQL Plus
sqlplus / as sysdba

解锁用户
alter user 用户名 account unlock;

修改用户密码
alter user 用户名 identified by 密码;

3. SQL Plus 直接登录数据
sqlplus 用户名/密码@ip:port/数据库实例
ip:本机ip127.0.0.1
sqlplus 用户名/密码 --连接默认实例

4. 不登录连接数据库
sqlplus /nolog

通过conn(ect)命令连接数据库
conn 用户名/密码@ip:port/数据库实例
conn scott/scott --连接到默认的数据库实例上
conn 用户名
conn 用户名/密码@orcl

SQL Plus 中的命令
1. l命令
L(IST):查看sqlplus缓存的上一条语句

2. /命令
/:执行缓存中的sql语句

如果说l命令是查询你刚上一句命令的话,那么 / 命令就是执行你的上一条命令
4. n命令
n:它是一个自然数,表示把光标放到缓存中sql语句的第n行

5. a命令
a :给当前行添加内容

6. c命令
c:修改sql语句的内容c /源字符串/新字符串

7. del命令
del:删除当前行的内容

8. show all
show all 显示sqlplus中的所有参数配置

9. col命令
col 列名|别名 for 显示格式
字符串格式:a长度 col hiredate for a2
数字格式:9点位符 col sal for 9999.99
col sal for L9999.99 --L 本地货币符号
col sal for $9999.99

10. save命令
save 文件路径:将执行的sql语句保存到文件中

11. spool命令
spool 文件路径
sql语句
spool off
将spool 和spool off之间所执行过的语句及结果保存到文件中

12. desc命令
desc 表名查看表结构

边栏推荐
- QT 基于QScrollArea的界面嵌套移动
- Leetcode-104. Maximum Depth of Binary Tree
- Prototype and prototype chain
- Oracle pl/sql these query results cannot be updated. Please include ROWID or use Select For update
- Console program for viewing BMP files
- 【CF#388 (Div. 2)】A. Bachgold Problem
- Leetcode-647. Palindromic Substrings
- Leetcode-9. Palindrome Numbber
- 2022低压电工操作证考试题模拟考试平台操作
- Education expert wangzhongze shared his experience for many years: family education is not a vassal
猜你喜欢

学 SQL 必须了解的10个高级概念

1、 Sqlserver2008 installation (with password), database creation, C form project test

Use definite integral to calculate triangle area

2022 melting welding and thermal cutting exam exercises and answers

Typora set markdown syntax inline mode

Nodejs database (Part 2)

Education expert wangzhongze shared his experience for many years: family education is not a vassal

Building a full-featured NAS server with raspberry pie (06): built-in file synchronization tool for penetration

资深OpenStacker - 彭博、Vexxhost升级为OpenInfra基金会黄金成员

2022年熔化焊接与热切割考试练习题及答案
随机推荐
554. brick wall
Bat (batch processing) processing special symbols (exclamation point, percent sign), etc
【CF】 A. New Year Candles
[deploy private warehouse based on harbor] 4 push image to harbor
Janus feature草稿
Niuke wrong question 3.1
Promise. All capture error
2022年熔化焊接与热切割考试练习题及答案
R语言并行计算实战教程
Leetcode-141. Linked List Cycle
The difference between arrow function and ordinary function
Mybags puls will report an error invalid bound statement (not found) when writing an SQL statement in the XML file:
big.js--使用/实例
【CF#654 (Div. 2)】A. Magical Sticks
Adventure of small X
337. house raiding III
学 SQL 必须了解的10个高级概念
服务器调参实录
213. house raiding II
[advanced concurrency] - thread pool summary