1.序列 以自增serial类型主键的序列: alter sequence s_seq restart with 1; #重置序列select currval('tablename_pid_seq');select nextval('tablename_pid_seq');select setval('tablename_pid_seq',1); 2.修改表 --删除约束alter table tablename alter column col drop not null; --添加约束alt
监控数据库运行 下面是整理.收集监控数据库运行的一些常用脚本,也是MS SQL 日常维护管理常用脚本(一)的续集,欢迎大家补充.提意见. 查看数据库登录名信息 Code Snippet SELECT name AS LoginName , dbname AS DefaultDB , createdate AS CreateD
在缺乏的可视化工具来监控数据库性能的情形下,常用的脚本就派上用场了,下面提供几个关于Oracle性能相关的脚本供大家参考.以下脚本均在Oracle 10g测试通过,Oracle 11g可能要做相应调整. 1.寻找最多BUFFER_GETS开销的SQL 语句 --filename: top_sql_by_buffer_gets.sql --Identify heavy SQL (Get the SQL with heavy BUFFER_GETS) SET LINESIZE 190 COL sql
SIPp,VOIP并发测试.性能测试的神器. 本文记录一下常用的脚本文件. 一.reg.xml 此文件是sipp的执行的脚本流程. <!-- --> <!-- You should have received a copy of the GNU General Public License --> <!-- along with this program; if not, write to the --> <!-- Free Software Foundation
增.删.改.查: postgres=# \password postgres 为postgres进行密码设置: postgres=# CREATE USER test WITH PASSWORD '123456'; 创建数据库用户: postgres=# CREATE DATABASE test OWNER test; 创建用户数据库并制定其所有者: postgres=# GRANT ALL PRIVILEGES ON DATABASE test to test; 将test数据库所有权限赋给t
题记:来源与网络和自己工作中总结.有些脚本片段,函数经常使用. 1.判断登录用户 1.1脚本 [devtac@test_1 shell]$ vi check_user.sh #! /bin/sh echo "You are logged in as `whoami`"; if [ `whoami` != devtac ]; then echo "Must be logged in as devtac to run this script." exit fi echo
查看数据库登录名信息 use mastergoSELECT name AS LoginName , dbname AS DefaultDB , createdate AS CreateDate, updatedate AS UpdateDate, language AS Language , THEN 'NT USER' ELSE 'SQL USER' END AS UserType FROM syslogins; 查看数据库用户信息 SELECT * FROM sysusers; 查看用户