本站用于记录日常工作内容,虚拟化云计算,系统运维,数据库DBA,网络与安全。
Oracle 创建视图与 使用函数转换时间戳方法。CREATE OR REPLACE FORCE VIEW VIEW_SIM(   SIM,   BILL_NUM,   EQUIP_TYPE,   POSITION_TYPE,   SIGN_STATE,   GOLD_STATE,   OPERATE_ID,   STARTTIME,   UPDATETIME)AS   SELECT t.sim,          t.bill_num,          t.equip_type,          t.position_type,          t.sign_state,          t.gold_state,          t.operate_id,          fun_utc2date (UTCDATE   => t.starttime,                        PATTERN   => 'YYYY-MM-DD HH24:MI:SS')             AS starttime,          fun_utc2date (UTCDATE   => t.updatetime,      &n...
Oracle 利用函数将时间戳转换成日期格式的方法。数据库中有三个字段,其中关于 时间的是采用 时间戳的格式存储的,如下图 SIM BILL_NUM STARTTIME 18307135480 9001445665 1598016414 18707204757 9001445665 1598016417 15207169407 9003664475 1598251705 18827672101 9003664475 1598251707 13437294319 99270014770 1598343236 13554194307 99270014770 1598343237 13437294316 99270014770 1598343238 13554194616 99270014770 1598343238   如果要查询一段时间内的数据,每次都要转换时间格式,很不方面。但是可以作了 时间戳转换日期的函数,这样每次只需要调用就可以了。/* 格式化对象 2020/9/2 16:47:52 (QP5 v5.287) */CREATE OR REPLACE FUNCTION FUN_UTC2DATE (UTCDATE NUMBER, PATTERN VARCHAR2)   RETURN DATEIS   Result   DATE;BEGIN   Result :=      TO_DATE (         TO_CHAR (              TO_DATE (19700101000000, 'YYYYMMDDHH24MISS')  &n...
oracle PLSQL,游标,loop循环删除部分表方法。使用Toad for Oracle时,使用新建用户连接时,连接身份 搞成了 as sysdba,导致执行添加表与表数据时,都变成sys账号下了。表比较多,删除时使用游标与loop循环,执行不成功。不清楚哪里不对(主要是水平太次,)。如下:declare  CURSOR d_cursor is    SELECT OBJECT_NAME      FROM sys.DBA_objects     WHERE OBJECT_TYPE = 'TABLE'       AND owner = 'STUDENT';  d_record d_cursor%ROWTYPE;begin  OPEN d_cursor;  LOOP    FETCH d_cursor      INTO d_record;    EXIT WHEN d_cursor%NOTFOUND;    execute immediate 'DROP TABLE ' || d_record.object_name || ' cascade constraints';    Dbms_Output.put_line(d_record.object_name || ' 表删除成功');  end loop;  close d_cursor;  commit;end;/行 2 出错ORA-00942: 表或视图不存在ORA-06512: 在 line 19脚本已在第 2行终止。(搞了很久才清楚,在sys或system账号会话连接中,只要添加 execute im...
下载备份脚本文件windows: 下载http://downinfo.myhostadmin.net/vps/bkupmysql.bat 保存到d盘根目录linux:  wget  http://downinfo.myhostadmin.net/vps/bkupmysql.sh 保存到/root目录3.编辑脚本文件windows:用记事本打开bkupmysql.bat     set dbuser=root                        #设置数据库用户,一般不需要修改set dbpass=passwd                      #设置数据库超管密码,需要修改为实际的密码set DaysAgo=7                          #设置保留天数set mysqlpath=d:\mysqlbak              #设置备份文件保存路径,一般不需要修改set mysql=D:\SOFT_PHP_PACKAGE\mysql\bin\mysql.exe   #设置备份文件保存路径,5.6版本需要修改路径set mysqldump=D:\SOFT_PHP_PACKAGE\mysql\bin\mysqldump.exe #设置mysql执行文件路径,5.6版本需要修改路径set logfile=d:\bkinfo.log     &n...
 
0

Redis 安全

发表者:admin分类:数据库DBA2020-07-13 10:37:22 阅读[60]
Redis 安全我们可以通过 redis 的配置文件设置密码参数,这样客户端连接到 redis 服务就需要密码验证,这样可以让你的 redis 服务更安全。实例我们可以通过以下命令查看是否设置了密码验证:127.0.0.1:6379> CONFIG get requirepass 1) "requirepass" 2) ""默认情况下 requirepass 参数是空的,这就意味着你无需通过密码验证就可以连接到 redis 服务。你可以通过以下命令来修改该参数:127.0.0.1:6379> CONFIG set requirepass "runoob" OK 127.0.0.1:6379> CONFIG get requirepass 1) "requirepass" 2) "runoob"设置密码后,客户端连接 redis 服务就需要密码验证,否则无法执行命令。语法AUTH 命令基本语法格式如下:127.0.0.1:6379> AUTH password实例127.0.0.1:6379> AUTH "runoob" OK 127.0.0.1:6379> SET mykey "Test value" OK 127.0.0.1:6379> GET mykey "Test value"
 
0

Redis 数据备份与恢复

发表者:admin分类:数据库DBA2020-07-13 09:39:21 阅读[60]
Redis 数据备份与恢复Redis SAVE 命令用于创建当前数据库的备份。语法redis Save 命令基本语法如下:redis 127.0.0.1:6379> SAVE 实例redis 127.0.0.1:6379> SAVE OK该命令将在 redis 安装目录中创建dump.rdb文件。恢复数据如果需要恢复数据,只需将备份文件 (dump.rdb) 移动到 redis 安装目录并启动服务即可。获取 redis 目录可以使用 CONFIG 命令,如下所示: redis 127.0.0.1:6379> CONFIG GET dir 1) "dir" 2) "/usr/local/redis/bin" 以上命令 CONFIG GET dir 输出的 redis 安装目录为 /usr/local/redis/bin。Bgsave创建 redis 备份文件也可以使用命令 BGSAVE,该命令在后台执行。实例127.0.0.1:6379> BGSAVE Background saving started
How To Shrink A Temporary Tablespace in Oracle DatabaseBy adminQuestion: How to resize the TEMPFILE(s) for a temporary tablespace after they have grown larger than needed?Large sort operations can cause temporary tablespaces to grow very large and as such there may be a need to ‘downsize’ after such operations. Until Oracle 11g there was no SQL command to release the unused allocated temporary space. One workaround for this problem is to create a new empty temporary tablespace with a smaller size, assign this new tablespace to the users and then drop the old tablespace. The disadvantage of this procedure is that it requires that no active sort operations are happening within the old temporary tablespace while it is being dropped.In Oracle 11g, a new feature was added that can be used to shrink temporary tablespaces. This command can be used to shrink only locally managed temporary tablespaces :ALTER TABLESPACE tablespace SHRINK SPACE | TEMPFILE tempfile_name [KEEP size];The&nbs...
 
0
What is MySQL Query CacheMySQL server features Query Cache Feature for a long time. When in use, the query cache stores the text of a SELECT query together with the corresponding result that is sent to a client. If another identical query is received, the server can then retrieve the results from the query cache rather than parsing and executing the same query again.It caches the full result set produced from a SELECT query:Queries executed must be identical.Cache is stored in system memory.Cache is checked before the query is parsed.Associated table updates invalidate query cache results. Prepared statements can be cached, but limitations exist. Some statements that do not use the query cache are:Queries that use nondeterministic functions.Queries that are a subquery of an outer queryQueries that are executed within the body of a stored function, trigger, or eventMySQL Query Cache SettingsThe query cache adds a few MySQL system variables for mysqld which may be set in a configuration...
    总共53页,当前第1页 | 页数:
  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11