目标 定时备份某用户的所有表 创建 sh 脚本 [oracle@szyxDBServer u01]$ vim backup.sh #!/bin/bash #本脚本自动备份30天的数据库,每次备份完成后,删除30天之前的数据。 #设置环境变量 export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin #获取当前时间,格式:20191115 DATE=$(date +%Y%m%d) #获取30天之前的时间 DATE_RM=$(date -d "30 days ago" +%Y%m%d) #设置备份目录, export DIR=/u01/expback #开始备份,此处采用exp方式导出 echo 'Oracle backup...' exp user/password@ORADB file=$DIR'/szyxadm_'$DATE'.dmp' buffer=20480 log=$DIR'.... Oracle 定时备份 Oracle
题目 Given a sorted linked list, delete all duplicates such that each element appear only once . Example 1: Input: 1->1->2 Output: 1->2 Example 2: Input: 1->1->2->3->3 Output: 1->2->3 解法 一:直接法 代码 [83] Remove Duplicates from Sorted List LeetCode
创建自定义 bridge 创建 docker network create my-net 查看列表 docker network ls 查看my-net docker network inspect my-net 删除 docker network rm my-net 容器连接自定义 bridge 创建新容器时连接 创建时加入命令 --network my-net 运行中的容器连接 使用命令(以redis容器为例) docker network connect my-net redis 断开连接 docker network disconnect my-net redis Docker 容器之间的通信 Docker
阿里巴巴Java开发手册中有这样一条: 【强制】线程池不允许使用 Executors 去创建,而是通过 ThreadPoolExecutor 的方式,这 样的处理方式让写的同学更加明确线程池的运行规则,规避资源耗尽的风险。 说明:Executors 返回的线程池对象的弊端如下: 1) FixedThreadPool 和 SingleThreadPool: 允许的请求队列长度为 Integer.MAX_VALUE,可能会堆积大量的请求,从而导致 OOM。 2) CachedThreadPool: 允许的创建线程数量为 Integer.MAX_VALUE,可能会创建大量的线程,从而导致 OOM。 因此,我们最好自己实现。 ThreadPoolExecutor 的实现 在 java.util.concurrent 包中,提供了 ThreadPoolExecutor 的实现。 public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, Blockin.... Java 线程池的使用 Java
题目 You are climbing a stair case. It takes_n_steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? 假设你正在爬楼梯。需要 n 阶你才能到达楼顶。 每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢? 注意:给定 n 是一个正整数。 示例 1: 输入: 2 输出: 2 解释: 有两种方法可以爬到楼顶。 1. 1 阶 + 1 阶 2. 2 阶 示例 2: 输入: 3 输出: 3 解释: 有三种方法可以爬到楼顶。 1. 1 阶 + 1 阶 + 1 阶 2. 1 阶 + 2 阶 3. 2 阶 + 1 阶 解法 要爬到第 n 阶,可以在 n-1 阶爬 1 步上去,或 n-2 阶爬 2 步上去。 所以可以得出 f(n)=f(n-1)+f(n-2) 即斐波那契数列 一 动态规划 思路 使用数组每个值 代码 二 使用斐波那契数列公式.... [70] Climbing Stairs LeetCode
汉字三种排序 按拼音排序 order by nlssort(columnName,'NLS_SORT=SCHINESE_PINYIN_M') 按笔画数排序 order by nlssort(columnName,'NLS_SORT=SCHINESE_STROKE_M') 简体中文按照第一顺序是“笔画数”,第二顺序是“部首”进行排序; 按部首排序 order by nlssort(columnName,'NLS_SORT=SCHINESE_RADICAL_M') 简体中文按照第一顺序是“部首”,第二顺序是“笔画数”进行排序 自定义排序 借助DECODE函数,自定义顺序排序 例:规定studentid为3的排第一位,为4的排第二位,剩下的按照studentid排序 order by decode(studentid,3,0,4,1),studentid Oracle 排序相关 Oracle
题目 Implementint sqrt(int x). Compute and return the square root of_x_, where x is guaranteed to be a non-negative integer. Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned. Example 1: Input: 4 Output: 2 Example 2: Input: 8 Output: 2 Explanation: The square root of 8 is 2.82842..., and since the decimal part is truncated, 2 is returned. 解法 一:使用Math.sqrt()方法 代码 class Solution { public int mySqrt(i.... [69] Sqrt(x) LeetCode
添加依赖 <!-- swagger --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.9.2</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.9.2</version> </dependency> 配置不同环境是否启用 在相应配置文件中添加(以yml为例) swagger: enable: true 创建配置类 @Configuration @EnableSwagger2 public class SwaggerConfig.... SpringBoot 集成 Swagger SpringBoot
File Header Edit -> File and Code Templates /** * * @author liyf * Created in ${YEAR}-${MONTH}-${DAY} */ Live Templates * * * 功能描述: * $params$ * @return $return$ * @author liyf */ params groovyScript("def result=''; def params=\"${_1}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) {result+=' * @param ' + params[i] + ((i < params.size() - 1) ? '\\n' : '')}; return result", methodParameters()) logger private static final Logger logger = .... IDEA 模板记录 Java