Thursday, May 26, 2016

How to fix the Account Locked (Timed) Oracle

Step 1: Check status of Account:


select username, account_status,profile from dba_users where username='APPUSER';


Step 2: Create an profile

CREATE PROFILE APP_DEFAULT LIMIT
COMPOSITE_LIMIT UNLIMITED
SESSIONS_PER_USER UNLIMITED
CPU_PER_SESSION UNLIMITED
CPU_PER_CALL UNLIMITED
LOGICAL_READS_PER_SESSION UNLIMITED
LOGICAL_READS_PER_CALL UNLIMITED
IDLE_TIME UNLIMITED
CONNECT_TIME UNLIMITED
PRIVATE_SGA UNLIMITED
FAILED_LOGIN_ATTEMPTS UNLIMITED
PASSWORD_LIFE_TIME UNLIMITED
PASSWORD_REUSE_TIME UNLIMITED
PASSWORD_REUSE_MAX UNLIMITED
PASSWORD_VERIFY_FUNCTION NULL
PASSWORD_LOCK_TIME UNLIMITED
PASSWORD_GRACE_TIME UNLIMITED;

Step 3: Grant the profile to user 'APPUSER':

ALTER USER appusr PROFILE app_default;

ALTER USER appusr ACCOUNT UNLOCK;

Step 4: Check againt status


select username, account_status,profile from dba_users where username='APPUSER';


USERNAME       ACCOUNT_STATUS
------------------------------ --------------------------------
PROFILE
------------------------------
APPUSER        OPEN
APP_DEFAULT

Thursday, May 19, 2016

Wednesday, May 18, 2016

How to set an expiration date for user' password on Linux

Step 1: Open file /etc/login.defs, change option for PASS_MAX_DAYS, For example:

# Password aging controls:
#
#       PASS_MAX_DAYS   Maximum number of days a password may be used.
#       PASS_MIN_DAYS   Minimum number of days allowed between password changes.
#       PASS_MIN_LEN    Minimum acceptable password length.
#       PASS_WARN_AGE   Number of days warning given before a password expires.
#
PASS_MAX_DAYS   90

Step 2: With exist user, you can change expiration date via command:

[root@VTGDB.COM ~]# chage -M 90 username

Monday, May 9, 2016

Installation Mysql, php, apache

My environment:



OS
Red Hat Enterprise Linux Server release 6.5 (Santiago)
MySQL
Version 5.1.73-community MySQL Community Server (GPL)
PHP
PHP 5.6.10 (cli)
Htdoc Directory
/u01/qlts/public_html
Apache Configuration Directory
/etc/httpd/conf

MySQL installation

Detail you can read it:

Step 1: Download MySQL
You access the internet via address:

Step 2: Extracting downloaded file to your installing directory:
[root@VTGDB.COM mysql]# tar -xvpf MySQL-community-5.1.73-1.rhel5.x86_64.rpm-bundle.tar 

Step 3: Install MySQL client-server:
[root@VTGDB.COM mysql]# rpm -ivh MySQL-server-community-5.1.73-1.rhel5.x86_64.rpm MySQL-client-community-5.1.73-1.rhel5.x86_64.rpm

Step 4: Install the “Header and Libraries” that are part of the MySQL-devel packages.
[root@VTGDB.COM mysql]# rpm -ivh MySQL-devel-community-5.1.73-1.rhel5.x86_64.rpm

Step 5: Change password for root
[root@VTGDB.COM mysql]# /usr/bin/mysqladmin -u root password '***********'

Step 6: Edit the MySQL Server configuration file:
[root@VTGDB.COM etc]# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
port=3306
user=mysql

#UTF 8 Setting
collation_server=utf8_unicode_ci
character_set_server=utf8
skip-character-set-client-handshake

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/u01/mysql/log/mysqld.log
pid-file=/u01/mysql/mysqld/mysqld.pid
[client]
port=3306

Step 7: Restart MySQL Server
[root@VTGDB.COM etc]# service mysql restart

Shutting down MySQL... [ OK ]

Starting MySQL. [ OK ]


Step 8: Login your new MySQL Server
[root@VTGDB.COM ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 604
Server version: 5.1.73-community MySQL Community Server (GPL)
Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>

Php Installation


Step 1: Download Php
You access the internet via address:

Step 2: Extract downloaded file to your installing directory:
[root@VTGDB.COM setup]# tar -xzvf php-5.6.10.tar.gz

Step 3: Run installation file
[root@VTGDB.COM setup]# cd php-5.6.10
[root@VTGDB.COM php-5.6.10]# ./configure  --with-apxs2=/usr/sbin/apxs  \
                                                                            --with-mysql  --with-pdo-mysql
[root@VTGDB.COM php-5.6.10]#make
[root@VTGDB.COM php-5.6.10]#make install

Step 4: Find and Edit php configuration file
[root@VTGDB.COM php-5.6.10]# cp php.ini-development /usr/local/lib/php.ini
[root@VTGDB.COM php-5.6.10]# vi /usr/local/lib/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Asia/Ho_Chi_Minh

Step 5: Prepare application directory
[root@VTGDB.COM php-5.6.10]# chsh -s /bin/bash apache
[root@VTGDB.COM php-5.6.10]# mkdir -p /u01/qlts/public_html
[root@VTGDB.COM php-5.6.10]# chown –R apache:apache /u01/qlts/public_html

Step 6: Find and Edit httpd configuration file:
[root@VTGDB.COM php-5.6.10]# vi /etc/httpd/conf/httpd.conf
Listen 8080
User apache
Group apache
#    Options FollowSymLinks
#    Allow from all
#    AllowOverride None
    Options FollowSymLinks
    AllowOverride All
#AddType application/x-tar .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html
    ServerAdmin thonh53@gmail.com
    DocumentRoot /u01/qlts/public_html
    ServerName VTGDB.COM
    ServerAlias VTGDB
    ErrorLog /u01/qlts/log/error.log
#    CustomLog logs/dummy-host.example.com-access_log common


Step 7: Restart Apache server
[root@VTGDB.COM php-5.6.10]# service httpd restart

Step 8: Test php
[root@VTGDB.COM php-5.6.10]# su – apache
[apache@VTGDB.COM ~]# cd /u01/qlts/public_html
[apache@VTGDB.COM public_html]# vi info.php
<?php 
     phpinfo();
?>              
Open your browser access address: http://YOUR_IP_SERVER:8080/info.php