Copy Paste Table on PostgreSQL

Copy Bulk / besar table gak gampang karena harus copy file di mana cukup take time, triknya sbb:



PostgreSQL copy table example

The following statement creates a new table named contacts for the demonstration:

In this table, we have two indexes: one index for the primary key and another for the UNIQUE constraint.

Let’s insert some rows into the contacts table:

To copy the contacts to a new table, for example, contacts_backup table, you use the following statement:

This statement creates a new table named contact_backup whose structure is the same as the contacts table. In addition, it copies data from the contacts table to the contact_backup table.

Let’s check the data of the contact_backup table by using the following SELECT statement:

It returns two rows as expected.

To examine the structure of the contact_backup table:

As you can see in the output, the structure of the contact_backup table is the same as the contactstable except for the indexes.

To add the primary key and UNIQUE constraints to the contact_backup table, you use the following ALTER TABLE statements:

To view structure of the contact_backup table again, you use \d command:

In this tutorial, you have learned how to copy an existing table to a new one using the various forms PostgreSQL copy table statement.


Belajar dari link ini:



# /etc/ssmtp.conf — a config file for sSMTP sendmail.
# See the ssmtp.conf(5) man page for a more verbose explanation of the
# available options.

# The person who gets all mail for userids < 500
# Make this empty to disable rewriting.

# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named
# The example will fit if you are in and your mailhub is so named.

# Example for SMTP port number 2525
# Example for SMTP port number 25 (Standard/RFC)
# mailhub=mail.your.domain
# Example for SSL encrypted connection
# mailhub=mail.your.domain:465

# Where will the mail seem to come from?

# The full hostname

# Set this to never rewrite the “From:” line (unless not given) and to
# use that address in the “from line” of the envelope.

# Use SSL/TLS to send secure messages to server.
# Use SSL/TLS certificate to authenticate against smtp host.

# Use this RSA certificate.

# Get enhanced (*really* enhanced) debugging information in the logs
# If you want to have debugging of the config file parsing, move this option
# to the top of the config file and uncomment



jangan lupa Revaliasess nya di ganti ya.




Send Email in Linux Server using SSMTP

sebenernya udah pakai beberapa kali tapi manusia tidak luput dari salah dan Lupa, jadi link yang gua pakai untuk install ini adalah :


Download & Install
# rpm -Uvh
# yum -y install ssmtp
Now we will editthe ssmtp configuration file.
# cd /etc/ssmtp
# vim /etc/ssmtp/ssmtp.conf
Here is the custom configuration         # SMTP server hostname and port
UseTLS=NO                             # Secure connection (SSL/TLS)
FromLineOverride=YES                  # Force the From: line           # The name of this host      # The host the mail appears to be coming from
Root=Bala                             # Redirect mail for root@ to postmaster@           # Your DreamHost mailaccount
AuthPass=myemailpassword              # The password for the mail account
Now let’sconfigure the Aliases
# vim /etc/ssmtp/revaliases
If you would like to change the “FromDisplay Name, edit the /etc/passwd and modify theuser alias
# vim /etc/passwd
Before we start using sSMTP lets stop thesendmail which is default installed on all Linux distribution.Stop sendmailservice to start after reboot
# service sendmail stop
# sudo chkconfig –levels 2345 sendmail off
Move or replace the sendmail and thencreate
a symbolic link for sSMTP to sendmail with authentication
# mv /usr/sbin/sendmail/usr/sbin/sendmail.orig
# ln -s /usr/sbin/ssmtp/usr/sbin/sendmail
We all done with the installation andconfiguration let’s send a test mail to internal & external email addressusing sSMTP.

echo”Sending Test mail to external & Internal email address”| mail -s”This is the test message using sSMTP”


thank you…

Mount / UnMount Share Drive from window or NAS

using CIFS

jika belum ada bisa di install

sudo apt-get install cifs-utils

Untuk Mount:

  1. buat folder di linux untuk tempat menampung mkdir /homexxxxx
  2.  command mounting: sudo mount.cifs // /homexxxxxx/ -o user=userxx
  3. enter dan akan meminta password



untuk Un Mount:

  1. sudo umount -a -t cifs -l 

good luck