Skip to content

Instantly share code, notes, and snippets.

View rponte's full-sized avatar
🏠
Working from home

Rafael Ponte rponte

🏠
Working from home
View GitHub Profile
-- obtem parametros da NLS (National Language Support) da sessão do usuário
select * from NLS_SESSION_PARAMETERS
-- altera NLS_LANGUAGE
ALTER SESSION SET NLS_LANGUAGE='BRAZILIAN PORTUGUESE'
@rponte
rponte / encoding-tips.sh
Last active May 10, 2019 11:30
Converting encoding with iconv command
# verifica encoding do arquivo
$ file -I script_perebento.sql
$ file -bI script_perebento.sql
# converte arquivo de ISO-8859-1 para UTF-8
$ iconv -f ISO-8859-1 -t UTF-8 script_perebento.sql > script_bonitao.sql
-- run as a privileged user
select dbms_xdb.gethttpport as port from dual;
begin
dbms_xdb.sethttpport('8081');
end;
@rponte
rponte / ORA-12519-error.sql
Created September 5, 2010 22:00
Increasing Processes, Sessions and Transactions in Oracle XE
-- Tendo problemas com "ORA-12519, TNS:no appropriate service handler found"?
-- dica: http://en.newinstance.it/2007/06/01/ora-12519-tnsno-appropriate-service-handler-found/
-- Basta rodar este comando e reiniciar o listener (OracleXETNSListener):
ALTER SYSTEM SET PROCESSES=150 SCOPE=SPFILE;
@rponte
rponte / oracle-list-loggedin-users.sql
Created September 6, 2010 21:03
listing and killing oracle sessions
-- comando para listar usuarios conectados no oracle
SELECT s.username, s.program, s.logon_time
FROM v$session s, v$process p, sys.v_$sess_io si
WHERE s.paddr = p.addr(+)
AND si.sid(+) = s.sid
AND s.username = 'MEU_USUARIO';
-- Kill oracle sessions
-- http://www.oracle-base.com/articles/misc/KillingOracleSessions.php
@rponte
rponte / JSF-2o-mau-habito.md
Last active December 31, 2015 15:56
JSF invoking multiples times the same method getter
@rponte
rponte / ExceptionHandler.java
Last active September 23, 2015 18:08
JSF Exception Handling with Spring AOP
package br.com.triadworks.sample.view.jsf;
import org.apache.commons.lang.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import br.com.triadworks.sample.view.util.FacesUtils;
public class ExceptionHandler {
/**
* Default error message
*/
-- create a custom database on SQLSERVER2005
CREATE DATABASE MyDb ON PRIMARY
(NAME = MyDb_Data,
FILENAME = 'C:\SQLServerData\Data\MyDb_Data.mdf',
SIZE = 250MB, MAXSIZE = UNLIMITED, FILEGROWTH = 5%)
LOG ON (NAME = MyDb_Log,
FILENAME = 'C:\SQLServerData\Log\MyDb_Log.ldf',
SIZE = 50MB,
MAXSIZE = 200MB,
-- create and alter database on SQLSERVER2005
CREATE DATABASE SysPDVWeb;
go
alter database MyDb
modify file
(name = 'MyDb',
size = 20mb,
filegrowth = 5%);
go
-- drop login on SQLSERVER2005
drop login syspdvweb;
-- check login at database
SELECT name, sid, type,
type_desc
FROM sys.server_principals
WHERE type = 'S';