martes, 6 de noviembre de 2018

ORACLE | Bloqueo de Tablas 2

select /*+ ordered
no_merge(L_WAITER)
no_merge(L_LOCKER) use_hash(L_LOCKER)
no_merge(S_WAITER) use_hash(S_WAITER)
no_merge(S_LOCKER) use_hash(S_LOCKER)
use_nl(O)
use_nl(U)
*/
/* first the table-level locks (TM) and mixed TM/TX TX/TM */
S_LOCKER.SID SID_LOCKER,
S_LOCKER.SERIAL# SERIAL#_LOCKER,
S_LOCKER.USERNAME USERNAME_LOCKER,
S_LOCKER.OSUSER OSUSER_LOCKER,
S_LOCKER.MODULE MODULE_LOCKER,
S_LOCKER.ACTION ACTION_LOCKER,
S_LOCKER.PROGRAM PROGRAM_LOCKER,
S_WAITER.SECONDS_IN_WAIT SECONDS_IN_WAIT,
S_WAITER.SID SID_WAITER,
S_WAITER.SERIAL# SERIAL#_WAITER,
S_WAITER.USERNAME USERNAME_WAITER,
S_WAITER.OSUSER OSUSER_WAITER,
S_WAITER.MODULE MODULE_WAITER,
S_WAITER.ACTION ACTION_WAITER,
S_WAITER.PROGRAM PROGRAM_WAITER,
'Table lock (TM): '||O.OWNER||'.'||O.OBJECT_NAME||
' - Mode held: '||
decode(L_LOCKER.LMODE,
0, 'None', /* same as Monitor */
1, 'Null', /* N */
2, 'Row-S (SS)', /* L */
3, 'Row-X (SX)', /* R */
4, 'Share', /* S */
5, 'S/Row-X (SSX)', /* C */
6, 'Exclusive', /* X */
'???: '||to_char(L_LOCKER.LMODE))||
' / Mode requested: '||
decode(L_WAITER.REQUEST,
0, 'None', /* same as Monitor */
1, 'Null', /* N */
2, 'Row-S (SS)', /* L */
3, 'Row-X (SX)', /* R */
4, 'Share', /* S */
5, 'S/Row-X (SSX)', /* C */
6, 'Exclusive', /* X */
'???: '||to_char(L_WAITER.REQUEST))
SQL_TEXT_WAITER
from
V$LOCK L_WAITER,
V$LOCK L_LOCKER,
V$SESSION S_WAITER,
V$SESSION S_LOCKER,
dba_objects O
where S_WAITER.SID = L_WAITER.SID
and L_WAITER.TYPE IN ('TM','TX')
and S_LOCKER.sid = L_LOCKER.sid
and L_LOCKER.ID1 = L_WAITER.ID1
and L_WAITER.REQUEST > 0
and L_LOCKER.LMODE > 0
and L_WAITER.ADDR != L_LOCKER.ADDR
and L_WAITER.ID1 = O.OBJECT_ID
union all
select /*+ ordered
no_merge(L_WAITER)
no_merge(L_LOCKER) use_hash(L_LOCKER)
no_merge(S_WAITER) use_hash(S_WAITER)
no_merge(S_LOCKER) use_hash(S_LOCKER)
no_merge(L1_WAITER) use_hash(L1_WAITER)
no_merge(O) use_hash(O)
*/
/* now the (usual) row-locks TX */
S_LOCKER.SID SID_LOCKER,
S_LOCKER.SERIAL# SERIAL#_LOCKER,
S_LOCKER.USERNAME USERNAME_LOCKER,
S_LOCKER.OSUSER OSUSER_LOCKER,
S_LOCKER.MODULE MODULE_LOCKER,
S_LOCKER.ACTION ACTION_LOCKER,
S_LOCKER.PROGRAM PROGRAM_LOCKER,
S_WAITER.SECONDS_IN_WAIT SECONDS_IN_WAIT,
S_WAITER.SID SID_WAITER,
S_WAITER.SERIAL# SERIAL#_WAITER,
S_WAITER.USERNAME USERNAME_WAITER,
S_WAITER.OSUSER OSUSER_WAITER,
S_WAITER.MODULE MODULE_WAITER,
S_WAITER.ACTION ACTION_WAITER,
S_WAITER.PROGRAM PROGRAM_WAITER,
'TX: '||O.SQL_TEXT SQL_TEXT_WAITER
from
V$LOCK L_WAITER,
V$LOCK L_LOCKER,
V$SESSION S_WAITER,
V$SESSION S_LOCKER,
V$_LOCK L1_WAITER,
V$OPEN_CURSOR O
where S_WAITER.SID = L_WAITER.SID
and L_WAITER.TYPE IN ('TX')
and S_LOCKER.sid = L_LOCKER.sid
and L_LOCKER.ID1 = L_WAITER.ID1
and L_WAITER.REQUEST > 0
and L_LOCKER.LMODE > 0
and L_WAITER.ADDR != L_LOCKER.ADDR
and L1_WAITER.LADDR = L_WAITER.ADDR
and L1_WAITER.KADDR = L_WAITER.KADDR
and L1_WAITER.SADDR = O.SADDR
and O.HASH_VALUE = S_WAITER.SQL_HASH_VALUE;

martes, 30 de octubre de 2018

ORACLE | Bloqueo de Tablas

select /*+ ordered
no_merge(L_WAITER)
no_merge(L_LOCKER) use_hash(L_LOCKER)
no_merge(S_WAITER) use_hash(S_WAITER)
no_merge(S_LOCKER) use_hash(S_LOCKER)
use_nl(O)
use_nl(U)
*/
/* first the table-level locks (TM) and mixed TM/TX TX/TM */
S_LOCKER.SID SID_LOCKER,
S_LOCKER.SERIAL# SERIAL#_LOCKER,
S_LOCKER.USERNAME USERNAME_LOCKER,
S_LOCKER.OSUSER OSUSER_LOCKER,
S_LOCKER.MODULE MODULE_LOCKER,
S_LOCKER.ACTION ACTION_LOCKER,
S_LOCKER.PROGRAM PROGRAM_LOCKER,
S_WAITER.SECONDS_IN_WAIT SECONDS_IN_WAIT,
S_WAITER.SID SID_WAITER,
S_WAITER.SERIAL# SERIAL#_WAITER,
S_WAITER.USERNAME USERNAME_WAITER,
S_WAITER.OSUSER OSUSER_WAITER,
S_WAITER.MODULE MODULE_WAITER,
S_WAITER.ACTION ACTION_WAITER,
S_WAITER.PROGRAM PROGRAM_WAITER,
'Table lock (TM): '||U.NAME||'.'||O.NAME||
' - Mode held: '||
decode(L_LOCKER.LMODE,
0, 'None', /* same as Monitor */
1, 'Null', /* N */
2, 'Row-S (SS)', /* L */
3, 'Row-X (SX)', /* R */
4, 'Share', /* S */
5, 'S/Row-X (SSX)', /* C */
6, 'Exclusive', /* X */
'???: '||to_char(L_LOCKER.LMODE))||
' / Mode requested: '||
decode(L_WAITER.REQUEST,
0, 'None', /* same as Monitor */
1, 'Null', /* N */
2, 'Row-S (SS)', /* L */
3, 'Row-X (SX)', /* R */
4, 'Share', /* S */
5, 'S/Row-X (SSX)', /* C */
6, 'Exclusive', /* X */
'???: '||to_char(L_WAITER.REQUEST))
SQL_TEXT_WAITER
from
V$LOCK L_WAITER,
V$LOCK L_LOCKER,
V$SESSION S_WAITER,
V$SESSION S_LOCKER,
sys.OBJ$ O,
sys.USER$ U
where S_WAITER.SID = L_WAITER.SID
and L_WAITER.TYPE IN ('TM','TX')
and S_LOCKER.sid = L_LOCKER.sid
and L_LOCKER.ID1 = L_WAITER.ID1
and L_WAITER.REQUEST > 0
and L_LOCKER.LMODE > 0
and L_WAITER.ADDR != L_LOCKER.ADDR
and L_WAITER.ID1 = O.OBJ#
and U.USER# = O.OWNER#
union all
select /*+ ordered
no_merge(L_WAITER)
no_merge(L_LOCKER) use_hash(L_LOCKER)
no_merge(S_WAITER) use_hash(S_WAITER)
no_merge(S_LOCKER) use_hash(S_LOCKER)
no_merge(L1_WAITER) use_hash(L1_WAITER)
no_merge(O) use_hash(O)
*/
/* now the (usual) row-locks TX */
S_LOCKER.SID SID_LOCKER,
S_LOCKER.SERIAL# SERIAL#_LOCKER,
S_LOCKER.USERNAME USERNAME_LOCKER,
S_LOCKER.OSUSER OSUSER_LOCKER,
S_LOCKER.MODULE MODULE_LOCKER,
S_LOCKER.ACTION ACTION_LOCKER,
S_LOCKER.PROGRAM PROGRAM_LOCKER,
S_WAITER.SECONDS_IN_WAIT SECONDS_IN_WAIT,
S_WAITER.SID SID_WAITER,
S_WAITER.SERIAL# SERIAL#_WAITER,
S_WAITER.USERNAME USERNAME_WAITER,
S_WAITER.OSUSER OSUSER_WAITER,
S_WAITER.MODULE MODULE_WAITER,
S_WAITER.ACTION ACTION_WAITER,
S_WAITER.PROGRAM PROGRAM_WAITER,
'TX: '||O.SQL_TEXT SQL_TEXT_WAITER
from
V$LOCK L_WAITER,
V$LOCK L_LOCKER,
V$SESSION S_WAITER,
V$SESSION S_LOCKER,
V$_LOCK L1_WAITER,
V$OPEN_CURSOR O
where S_WAITER.SID = L_WAITER.SID
and L_WAITER.TYPE IN ('TX')
and S_LOCKER.sid = L_LOCKER.sid
and L_LOCKER.ID1 = L_WAITER.ID1
and L_WAITER.REQUEST > 0
and L_LOCKER.LMODE > 0
and L_WAITER.ADDR != L_LOCKER.ADDR
and L1_WAITER.LADDR = L_WAITER.ADDR
and L1_WAITER.KADDR = L_WAITER.KADDR
and L1_WAITER.SADDR = O.SADDR
and O.HASH_VALUE = S_WAITER.SQL_HASH_VALUE;

viernes, 3 de agosto de 2018

ASP.NET | Error al levantar aplicacion


ASP.NET Tiempo de espera



DotNet .basic Envio Correos

al error :
The remote certificate is invalid according to the validation procedure.

System.Net.ServicePointManager.ServerCertificateValidationCallback = _
Function(se As Object, _
cert As System.Security.Cryptography.X509Certificates.X509Certificate, _
chain As System.Security.Cryptography.X509Certificates.X509Chain, _
sslerror As System.Net.Security.SslPolicyErrors) True

viernes, 27 de julio de 2018

SQL SERVER | Consultar Excel

EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'DynamicParameters', 1
exec sp_configure 'Advanced', 1
RECONFIGURE
exec sp_configure 'Ad Hoc Distributed Queries', 1
RECONFIGURE
exec sp_configure 'xp_cmdshell', 1
RECONFIGURE
GO
sp_configure 'show advanced options', 1
GO
RECONFIGURE WITH OverRide
GO
sp_configure 'Ad Hoc Distributed Queries', 1
GO
RECONFIGURE WITH OverRide
GO


SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=d:\tmp\MCRESPALDO_06_07_2018.xlsx;HDR=YES','SELECT * FROM [mc$]')

martes, 22 de mayo de 2018

AWS - GODADDY | Configurar Dominio

AWS
Hosted Zones >
[Create Hosted Zone]
Domain Name : midominio.com
[Create]
[Create Record Set]
Name :
Type : A - IPv4 address
Alias : No
Value : 89.89.21.23
[Create]
[Create Record Set]
Name : www
Type : A - IPv4 address
Alias : Yes
Alias Target : midominio.com
[Create]

GODADY
Servidores de nombres
[Cambiar]
Agregar los 4DNS de AWS
[Guardar]

miércoles, 16 de mayo de 2018

AWS LINUX | INSTALAR LAMP - PHPMYADMIN

1.- INSTALAR LAMP / PHPMYADMIN
# yum remove httpd-tools
# yum install -y httpd24 php70 mysql56-server php70-mysqlnd
# service httpd start
# chkconfig httpd on
# chkconfig --list httpd

agregar usuario :
# usermod -a -G apache ec2-user
# chmod 2775 /var/www
# find /var/www -type d -exec chmod 2775 {} \;
# find /var/www -type f -exec chmod 0664 {} \;

verificar php
# echo "" > /var/www/html/phpinfo.php
http://my.public.dns.amazonaws.com/phpinfo.php
# yum list installed httpd24 php70 mysql56-server php70-mysqlnd

verificar base de datos y cambio de la base de datos
# service mysqld start
# mysql_secure_installation
# service mysqld stop
# chkconfig mysqld on

instalar php myadmin
# yum install php70-mbstring.x86_64 php70-zip.x86_64 -y
# service httpd restart
# wget https://files.phpmyadmin.net/phpMyAdmin/4.8.0.1/phpMyAdmin-4.8.0.1-all-languages.zip
# unzip phpMyAdmin-4.8.0.1-all-languages.zip -d phpmyadmin
# service mysqld start
http://my.public.dns.amazonaws.com/phpmyadmin


Configurar PhpAdmyn para tener 2 conexiones en un mismo servidor
# cp config.sample.inc.php config.inc.php

editar config.inc.php
$i++;
$cfg['Servers'][$i]['verbose'] = 'Database Server 2';
$cfg['Servers'][$i]['host'] = '192.168.1.102';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

AWS LINUX | INSTALAR TOMCAT 8

4. INSTALACION DE TOMCAT 8.5
yum install tomcat8-webapps
yum install tomcat8-admin-webapps
service tomcat8 start

AWS LINUX | Instalar JAVA 8

1. INSTALACION DE JAVA
# java -version
# yum remove java
# yum install java-1.8.0-openjdk

AWS LINUX | Verificar aplicaciones ya instaladas

1.- VERIFICAR LAS APLICACIONES YA INSTALADAS
yum grouplist
yum groupinfo "Group Name"
yum list installed

AWS LINUX | Memoria

1.- VERIFICACION/USO DE MEMORIA
# yum install htop

# free -m
# cat /proc/meminfo
# vmstat -s
# top
# htop

martes, 15 de mayo de 2018

AWS LINUX 2 | Configurar LAMP - PHPAMYDMIN

1.- actualizar el SO
# yum update -y

2-. verificar la instalaccion de la apache
# yum install httpd

3.- iniciar el servicio
# service httpd start

4.- instalar LAMP
# amazon-linux-extras install lamp-mariadb10.2-php7.2 php7.2

5.- instalar mariadb-server
# yum install -y httpd mariadb-server

6.- iniciar apache
# systemctl start httpd

7.- ponerlo para que inicie en automatico (verificacion si esta activo )
# systemctl enable httpd
# systemctl is-enabled httpd

8- agregar usuario ec2-user a grupo apache
# usermod -a -G apache ec2-user

9.- cambiar el propietario del grupo de apache
# chown -R ec2-user:apache /var/www

10.- agregar los permisos a futuros directorios
# chmod 2775 /var/www && find /var/www -type d -exec chmod 2775 {} \;

11.- agregar permisos a las carpetas y subcarpetas
# find /var/www -type f -exec chmod 0664 {} \;

12.- create archivo phpinfo.php con el siguiemte contenido
#

13.- reiniciar los servicios de httpd

14.- iniciar la bd mariadb
# systemctl start mariadb

15.- iniciar en modo seguro
# mysql_secure_installation

To install phpMyAdmin
1.- instalar dependencias
# yum install php-mbstring -y

2.- reiniciar el apache
# systemctl restart httpd

3.- reiniciar php fpm
# systemctl restart php-fpm

4.- ubicarte en la carpeta en donde se instalar
# cd /var/www/phpmyadmin
# wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz

5.- descomprimir los archivos en la carpeta "phpmyadmin"
# tar -xvzf phpMyAdmin-latest-all-languages.tar.gz -C phpmyadmin --strip-components 1

6.- reiniciar la base de datos
# systemctl start mariadb

7.- navegar en el phpmyadmin
# http://my.public.dns.amazonaws.com/phpmyadmin

Configurar PhpAdmyn
1.- copiar el archivo de configuracion
# cp config.sample.inc.php config.inc.php

2.- agregar los siguientes campos en config.inc.php
$i++;
$cfg['Servers'][$i]['verbose'] = 'Database Server 2';
$cfg['Servers'][$i]['host'] = '192.168.1.102';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

miércoles, 9 de mayo de 2018

AWS LINUX 2 | uninstall nginx

[root@server]# service nginx stop

[root@server]# chkconfig nginx off

[root@server]# yum remove nginx

martes, 8 de mayo de 2018

MySql | Restaurar información desde un txt

1.- editar my.ini para que pueda leer archivos de cualquier lugar
secure-file-priv=""

2.- reiniciar servicios de MySql

3.- linea de comandos de S.O.
c:\cd C:\Program Files\MySQL\MySQL Server 5.7\bin

4.- conectarse
c:\ mysql --user={aqui va el usuario} --password {aqui la base de datos}
# pide clave

5.- comando para restaurar la base de datos
LOAD DATA INFILE 'D:\\tmp\\bd.txt'
INTO TABLE usuario
FIELDS TERMINATED BY '|' IGNORE 1 LINES ;

Otros
* mysql> SHOW VARIABLES LIKE "secure_file_priv";

lunes, 30 de abril de 2018

AWS | Conectar EC2 y EFS

1.- conectarse a Amazon Linux
user : ec2-user

2.- conectarse como super usuario
# sudo su

3.- instalar los utilidades de efs en el servidor
# sudo yum install -y amazon-efs-utils

4.- ir a la carpeta donde se montara el disco virtual
# cd /mnt

5.- crear carpeta efs en donde se montara las unidades
# mkdir efs
# cd efs
# mkdir edocumento

6.- montar disco
# mount -t efs fs-12345678:/ /mnt/efs

7.- ver dispositivos montados
# findmnt
OR
# cat /proc/self/mounts
OR
# cat /proc/mounts
OR
# df -h
OR
# lsblk -fm
OR
# fdisk -l

8.- automontar
# /etc/fstab
# fs-12345678 /mnt/efs efs defaults,_netdev 0 0

9.- permisos en la carpeta para que otros tengan permisos de escritura
# chmod 777 *

NOTA
ver que los grupos de seguridad sean los mismos

miércoles, 25 de abril de 2018

lunes, 9 de abril de 2018

CENTOS 7 MINI : Red

1.- ver tarjetas de red
# nmcli d
2.- modificar tarjetas de red
# nmtui


https://www.krizna.com/centos/setup-network-centos-7/

domingo, 8 de abril de 2018

AWS - Amazon Linux 2 LTS | install Nginx

en la consola por SSH:

# wget -r --no-parent -A 'epel-release-*.rpm' http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/

# rpm -Uvh dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-*.rpm

# ls -l /etc/yum.repos.d/

* reiniciar servicios
# service nginx start
OR
# systemctl start nginx

DOCUMENTACION DE REFERENCIA
https://github.com/tooltwist/documentation/wiki/Installing-EPEL-Repository-on-Amazon-AWS-EC2
https://comtechies.com/how-to-install-and-configure-nginx-on-amazon-ec2-rhel-and-ubuntu-instances.html