Skip to content

Instantly share code, notes, and snippets.

View sytkov's full-sized avatar

Dmitry Sytkov sytkov

View GitHub Profile
@sytkov
sytkov / query.plsql
Created April 24, 2012 13:18
Get current user / schema name ( for session )
select Schemaname into v_ObjectType
from v$session
where audsid = TO_NUMBER( sys_context('userenv','sessionid') )
;
@sytkov
sytkov / demo.py
Created May 23, 2012 17:01
Рекурсивный обход директорий
# coding=utf-8
import os
for name in os.listdir ( '.' ) :
if '.' not in name :
for dir , subDirs , files in os.walk ( name ) :
for file in files :
print file
@sytkov
sytkov / script.sh
Created November 3, 2012 16:26
oracle installation
iptables -I INPUT -p tcp --dport 1521 -j ACCEPT
iptables -I INPUT -p tcp --dport 1522 -j ACCEPT
@sytkov
sytkov / gist:4031270
Created November 7, 2012 12:24
/etc/init.d/tomcat7
#!/bin/sh
#
# Description: /opt/tomcat7 Start Stop Restart
# processname: tomcat7
# chkconfig: 2345 20 80
export JDK_HOME=/usr/java/jdk1.6.0_37
export JRE_HOME=/usr/java/jdk1.6.0_37/jre
CATALINA_HOME=/opt/tomcat7
CATALINA_OPTS="-Xms512M -Xmx1024M"
@sytkov
sytkov / gist:4031302
Created November 7, 2012 12:26
/etc/init.d/oracle
#!/bin/sh
# description: Starts and stops the Oracle database and listeners
# processname: oracle
# chkconfig: 2345 20 80
export ORACLE_BASE=/opt/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=vo2
export PATH=$ORACLE_HOME/bin:$PATH
@sytkov
sytkov / smb.conf
Created November 9, 2012 12:22
/etc/samba/smb.conf
semanage fcontext -a -t samba_share_t /root/downloads
chcon -R -t samba_share_t /root/downloads
@sytkov
sytkov / query.sql
Created June 26, 2013 06:05
Current query from session
select s.sql_id, t.sql_text
from V$SESSION s, v$sqltext_with_newlines t
where
s.status = 'ACTIVE'
and s.username = :p_schema
and s.machine = :p_machine
and t.address =s.sql_address
and t.hash_value = s.sql_hash_value
and s.sid = :p_sid
and s.type <>'BACKGROUND'
@sytkov
sytkov / query.sql
Created June 26, 2013 06:07
Oracle. Current session longops
SELECT s.username,
sl.sid,
sq.executions,
sl.last_update_time,
sl.sql_id,
sl.sql_hash_value,
opname,
target,
elapsed_seconds,
time_remaining,
@sytkov
sytkov / run_sql.sql
Last active December 19, 2015 00:19
declare
v_error_message varchar2(4000);
function is_empty_field(p_field_name in varchar2, p_field_value in varchar2, p_error_message out varchar2)
return boolean is
begin
IF p_field_value is not null then
p_error_message := 'заполнено поле "'||p_field_name||'"';
return true;
end if;
@sytkov
sytkov / run_plsql.sql
Last active December 19, 2015 01:19
Work with DBMS_SQL package
set serveroutput on;
DECLARE
v_cursor_id number;
v_last_scale_division_idx number;
v_column_int number;
v_column_str varchar2(4000);
v_fetched_cnt number;
BEGIN
select max(column_id)
into v_last_scale_division_idx