DBI && MySQL lock
my $npmdb_dbh = DBI->connect("DBI:ODBC:npmdb", "informix","*******",{RaiseError=>0,PrintError=>0});
my $gisdb_dbh = DBI->connect("DBI:Oracle:gisdb", "gis","*******",{RaiseError=>1,AutoCommit=>0});
$npmdb_dbh->do("set isolation to dirty read");
my $sel_sql = " select a.first_result,a.ne_id,
NVL(CSTRAFFIC_CONV11,0),
round(SFB_DIVFLOAT_1(NVL(b.ATTOUTPSUTRAN,0)-NVL(b.FAILOUTPSUTRAN,0),NVL(b.ATTOUTPSUTRAN,0),0,0)*100,2)
from tpc_utrancell_ne a ,TPC_UTRANCELL_HO_NE b,TPC_UTRANCELL_HSPA_NE c
where a.first_result = current year to hour - $para units hour ||':00:00'
and a.first_result = b.first_result
and a.first_result = c.first_result
and a.ne_id = b.ne_id
and a.ne_id = c.ne_id";
my $rsite = $npmdb_dbh->prepare($sel_sql);
$rsite->execute();
my $ref_data = $rsite->fetchall_arrayref();
$rsite->finish;
$gisdb_dbh->do("delete from BTS_PM_TD where first_result <= sysdate - 74/24");
$gisdb_dbh->do("commit");
$npmdb_dbh->disconnect();
$gisdb_dbh->disconnect();
1,Pthread线程控制
int pthread_create(pthread_t *restrict tidp, const pthread_attr_t *restrict attr, void *(*stat_rtn)(void*), void *restrict arg);
int pthread_exit(void *status);
int pthread_cancel(pthread_t thread);
int pthread_join(pthread_t tid, void **tret);
int pthread_cleanup_push(void (*rtn)(void*), void *arg);
int pthread_clean_pop(int execute);
int pthread_equal(pthread_t tid1, pthread_t tid2);
pthread_t pthread_self(void);
2,Pthread提供多种同步机制:
1) Mutex(互斥量):pthread_mutex_xxx
2) Condition Variable(条件变量):pthread_con_xxx
3) Read/Write lock(读写锁):pthread_rwlock_xxx
4) Spin lock(自旋锁):pthread_spin_xxx
int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr); // PTHREAD_MUTEX_INITIALIZER
int pthread_mutex_destroy(pthread_mutex_t *mutex);
int pthread_mutex_lock(pthread_mutex_t *mutex);
int pthread_mutex_trylock(pthread_mutex_t *mutex);
int pthread_mutex_unlock(pthread_mutex_t *mutex);
int pthread_rwlock_init(pthread_rwlock_t *restrict rwlock, const pthread_rwlockattr_t *restrict attr);
int pthread_rwlock_destroy(pthread_rwlock_t *rwlock);
int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock);
int pthread_rwlock_wrlock(pthread_rwlock_t *rwlock);
int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock);
int pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock);
int pthread_rwlock_unlock(pthread_rwlock_t *rwlock);
int pthread_cond_init(pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr);
int pthread_cond_destroy(pthread_cond_t *cond);
int pthread_cond_wait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex);
int pthread_cond_timedwait(pthread_cond_t *restict cond, pthread_mutex_t *restrict mutex, const struct timespec *restrict abstime);
int pthread_cond_signal(pthread_cond_t *restrict cond);
int pthread_cond_broadcast(pthread_cond_t *restrict cond);
int pthread_spin_init(pthread_spinlock_t *lock, int pshared);
int pthread_spin_destroy(pthread_spinlock_t *lock);
int pthread_spin_lock(pthread_spinlock_t *lock);
int pthread_spin_trylock(pthread_spinlock_t *lock);
DBI && MySQL lock的更多相关文章
- [MySQL] lock知识梳理
MySQL Lock机制 INDEX: MySQL事务隔离级别 MVCC MySQL Lock类型 MySQL MDL CONTENT: 1. MySQL事务隔离级别 Read Uncommit RU ...
- innobackupex: Connecting to MySQL server with DSN 'dbi:mysql
[root@ma src]# innobackupex --user=root /root/backup --no-timestamp InnoDB Backup Utility v1.5.1-xtr ...
- mysql Lock wait timeout exceeded; try restarting transaction解决
前面已经了解了InnoDB关于在出现锁等待的时候,会根据参数innodb_lock_wait_timeout的配置,判断是否需要进行timeout的操作,本文档介绍在出现锁等待时候的查看及分析处理: ...
- MySQL LOCK TABLES 与UNLOCK TABLES
http://blog.csdn.net/zyz511919766/article/details/16342003 1语法 LOCK TABLES tbl_name[[AS] alias] lock ...
- mysql show processlist 命令检查mysql lock
processlist命令的输出结果显示了有哪些线程在运行,可以帮助识别出有问题的查询语句,两种方式使用这个命令. 1. 进入mysql/bin目录下输入mysqladmin processlist; ...
- MySql Lock wait timeout exceeded该如何处理? (转载)
转载 https://ningyu1.github.io/site/post/75-mysql-lock-wait-timeout-exceeded/ 这个问题我相信大家对它并不陌生,但是有很多人对它 ...
- MySQL - Lock wait timeout exceeded
今天突然出了个奇怪的问题,原本正常启动的项目,在什么都没有修改的情况下,启动到一半的时候会卡住几分钟,几分钟后又成功启动了,刚好是卡在Quartz那里,还以为出什么奇奇怪怪的幺蛾子了,一看日志,数据库 ...
- mysql Lock wait timeout exceeded; try restarting transaction
查看innodb的事务表INNODB_TRX,看下里面是否有正在锁定的事务线程,看看ID是否在show full processlist里面的sleep线程中,如果是,就证明这个线程事务一直没有com ...
- Mysql Lock wait timeout exceeded; try restarting transaction的问题
今天在后台跑任务的时候,发现了数据库报错1205 - Lock wait timeout exceeded; try restarting transaction.问题原因是因为表的事务锁,以下是解决 ...
随机推荐
- Visual Studio 使用技巧
整理备用: 1. 键入prop后,连续按两下tab, 可以自动生成属性,然后输入类型和名称. 类似的还有: propg, 生成private set的属性 propfull,生成私有字段,和相应属性 ...
- 在sql server中怎样获得正在执行的Sql查询
方法1:使用DBCC inputbuffer(spid) 使用SP_WHO获得SPID,然后再执行上面的DBCC command,参见下图 执行一段sql语句 打开另一个query窗口并执行SP_WH ...
- ASP.net与SQLite数据库通过js和ashx交互(连接和操作)
ASP.net与SQLite数据库通过js和ashx交互(连接和操作): 废话(也是思路):用的是VS2010,打算做网站前后台.由于不喜欢前台语言里加些与html和css和js的其他内容,想实现前后 ...
- tp其他功能
数据缓存 在ThinkPHP中进行缓存操作,一般情况下并不需要直接操作缓存类,因为系统内置对缓存操作进行了封装,3.1版本推荐的数据缓存方法是cache方法,基本的用法是:(3.1.2版本cache方 ...
- openstack安装记录(一)环境准备
参考文献: 官方文档 http://docs.openstack.org/mitaka/zh_CN/install-guide-rdo/index.html 最小实例: 控制节点: 1 处理器, 4 ...
- Hibernate 体系结构简述
SessionFactory: Hibernate的关键对象,它是单个数据库映射关系经过编译后的内存镜像,同时它是线程安全的.它是生成Session的工厂,本身需要依赖于ConnectionProvi ...
- SQL Server dbcc checkdb 修复
默认dbcc checkdb 只做数据库的检测数据库是否完好.不会主动做数据库的修复,要修复数据库,需要数据库设单用模式. 1.repair_allow_data_loss 可能导致数据丢失. 2. ...
- 当 IDENTITY_INSERT 设置为 OFF 时,不能为表 'tb_MyInvoices' 中的标识列插入显式值
默认情况下,IDENTITY_INSER就是off 这种情况下,你写insert 语句时,identity栏位,不要写值,系统会自动帮你写入. 举例说明: ,),dt datetime,pay int ...
- Outlook2007、2010和Foxmail的簽名設計
由於個人習慣問題公司大部分人採用第三方郵件工具,對與郵件的通訊設置大家完全可以通過嚮導完成,但是郵件的簽名設計往往隐藏了起来,现在就由我来带大家进行个性签名设计. Outlook2007 第一步: 点 ...
- JDBC批量操作
/** * 批量执行预定义模式的SQL */ public static void exeBatchParparedSQL() { ...