当前位置:网站首页>linux下oracle常见操作以及日常积累知识点(函数、定时任务)
linux下oracle常见操作以及日常积累知识点(函数、定时任务)
2022-08-05 10:08:00 【qingfengvssuibian】
oracle的启动、关闭
#用dba的身份登录
sqlplus / nolog conn / as sysdba
#启动
startup
#关闭
shutdown immediate
监听启动:
#监听启动
lsnrctl start
#监听状态
lsnrctl status
#监听停止
lsnrctl stop
Trunk函数:截取日期或者数字
--截取日期
select trunc(sysdate,'yyyy') from dual union all --精确到年,显示当年第一天
select trunc(sysdate,'mm') from dual union all --月
select trunc(sysdate,'dd') from dual union all --天
select trunc(sysdate,'hh') from dual union all --小时
select trunc(sysdate,'mi') from dual union all --分
select trunc(sysdate) from dual union all --和精确到天一样 dd
select sysdate from dual union all
SELECT (sysdate + 1) FROM dual; --下一天 1代表1天的意思,+1就是下一天 +1/24代表加一个小时
--截取数值,不进行四舍五入,可用于保留有效数字
select trunc(155.555) from dual union all --保留三位有效数字
select trunc(155.555,3) from dual union all
select trunc(155.555,2) from dual union all
select trunc(155.555,0) from dual union all
select trunc(155.555,-2) from dual; --保留-2位有效数字
forupdate和rowid修改数据
出现无法修改数据(只读readonly模式),可以尝试只修改一张表。一般建议使用rowid。
定时任务
每隔一段时间执行一次任务。不多说,直接上操作。
创建新表
create table testDsrw(
name varchar2(50),
riqi date
);创建存储过程
create or replace procedure testPro is
begin
insert into testdsrw(name,riqi)values('tie',sysdate);
commit;
end testPro;
可视化创建定时任务job
在DBMS_JOBS下新建job,并配置红色部分,其中内容写上存储过程的名字(后面必须跟上分号,不然报错),在间隔中写入下次执行时间,例如 TRUNC(sysdate,'mi') + 1/(24*60),代表下一分钟。至此,一个简单的定时任务创建完成。

启动
点击应用即可

停止
点击 断开然后再次应用即可停止定时任务

至此定时任务界面版介绍完成。
边栏推荐
猜你喜欢

Our Web3 Entrepreneurship Project, Yellow

2022 Huashu Cup Mathematical Modeling Question A Optimization Design Ideas for Ring Oscillators Code Sharing

基于MindSpore高效完成图像分割,实现Dice!

NowCoderTOP35-40——持续更新ing

The technological achievements of Shanghai Konan were selected into the "2021 Shanghai Network Security Industry Innovation Research Achievement Catalog" by the Municipal Commission of Economy and Inf

Still looking for a network backup resources?Hurry up to collect the following network backup resource search artifact it is worth collecting!

C语言的高级用法

还在找网盘资源吗?快点收藏如下几个值得收藏的网盘资源搜索神器吧!

How can project cost control help project success?

Pycharm 常用外部工具
随机推荐
js hijacks the array push method
公众号如何运维?公众号运维专业团队
七夕浪漫约会不加班,RPA机器人帮你搞定工作
无题九
NowCoderTOP35-40——持续更新ing
项目成本控制如何帮助项目成功?
Why are RELTABLESPACE values 0 for many tables displayed in sys_class?
无题七
19. Server-side session technology Session
5. Deploy the web project to the cloud server
无题一
无题十一
无题五
Technical dry goods | Hausdorff distance for image segmentation based on MindSpore
皕杰报表的下拉框联动
Can MySQL use aggregate functions without GROUP BY?
Custom filters and interceptors implement ThreadLocal thread closure
第八章:activiti多用户任务分配
NowCoderTOP35-40 - continuous update ing
Voice-based social software development - making the most of its value