Cara menggunakan unlock table mysql

Kami berharap bahwa Anda menikmati presentasi ini . Untuk men-download , silahkan rekomendasi presentasi ini kepada teman-teman Anda dalam jaringan sosial . Tombol yang haris diklik terletak di bawah posting ini . Terima kasih .

Tombol:

Demo Komparasi Row dan Table Locking pada MySQL dengan Oracleg11 from Philo Mushofi El Haries

MySQL – Latu – 13505019 – Mengunci dan Membuka Tabel -4 by catbasdat

Mei 30, 2007, 11:50 am
Filed under: Eksplorasi MySQL

Penguncian tabel secara permanen, terkadang diperlukan sekali ketika kita ingin melakukan backup maupun
recovery dengan sempurna. Perintah ini akan mengunci semua tabel pada database secara permanen sehingga
hanya dapat ditampilkan saja tanpa bisa dimodifikasi, sampai user root membuka kembali tabel tersebut.

Penguncian secara permanen: FLUSH TABLES WITH READ LOCK;

Selain penguncian secara permanen, kita juga dapat melakukan penguncian tabel yang sifatnya sementara, yaitu:
LOCK TABLES nama_tabel READ;

Option selain READ adalah WRITE,
perbedaannya adalah jika kita menggunakan READ, maka user masih bisa melihat informasi yang ada di dalam tabel.

Unlock tabel hanya bisa dilakukan oleh user yang mengunci tabel tersebut. Perintah unlock:
UNLOCK TABLES;

Iklan

Share this:

  • Twitter
  • Facebook

Menyukai ini:

Suka Memuat...

Terkait


Tinggalkan sebuah Komentar so far
Tinggalkan komentar

RSS feed for comments on this post. TrackBack URI



Tinggalkan Balasan

Ketikkan komentar di sini...

Isikan data di bawah atau klik salah satu ikon untuk log in:

Email (wajib) (Alamat takkan pernah dipublikasikan)

Nama (wajib)

Situs web

You are commenting using your WordPress.com account. ( Logout /   )

You are commenting using your Twitter account. ( Logout /   )

You are commenting using your Facebook account. ( Logout /   )

Batal

Connecting to %s

Beri tahu saya komentar baru melalui email.

Beritahu saya pos-pos baru lewat surat elektronik.

Δ

A session releases all the tables locks with it at once. You can implicitly release the table locks. If the connection to the server terminates explicitly or implicitly all the locks will be released.

You can release the locks of a table explicitly using the UNLOCK TABLES statement.

Syntax

Following is the syntax of the MySQL UNLOCK TABLES statement −

UNLOCK TABLES

Example

Suppose we have created a table that contains the sales details along with the contact details of the customers as shown below −

mysql> CREATE TABLE SalesDetails (
   ID INT,
   ProductName VARCHAR(255),
   CustomerName VARCHAR(255),
   DispatchDate date,
   DeliveryTime time,
   Price INT,
   Location VARCHAR(255),
   CustomerAge INT,
   CustomrtPhone BIGINT,
   DispatchAddress VARCHAR(255),
   Email VARCHAR(50)
);

Now, let’s insert 2 records into the above created table using the INSERT statement as −

mysql> insert into SalesDetails values(1, 'Key-Board', 'Raja', DATE('2019-09-01'), TIME('11:00:00'), 7000, 'Hyderabad', 25, '9000012345', 'Hyderabad – Madhapur', '[email protected]');
Query OK, 1 row affected (0.84 sec)
mysql> insert into SalesDetails values(2, 'Mobile', 'Vanaja', DATE('2019-03-01'), TIME('10:10:52'), 9000, 'Chennai', 30, '90000123654', 'Chennai- TNagar', '[email protected]'); 
Query OK, 1 row affected (1.84 sec)

If we want another table with just the contact details of the customer create a table as −

mysql> CREATE TABLE CustContactDetails (
   ID INT,
   Name VARCHAR(255),
   Age INT,
   Phone BIGINT,
   Address VARCHAR(255),
   Email VARCHAR(50)
);

Following queries insets records into the CustContactDetails table using the INSERT INTO SELECT statement. Here, we are trying to insert records from the SALES_DETAILS table to CustContactDetails table.

Here before the transfer, we are acquiring the write lock on the table to which we are inserting records and acquiring read lock on the table from which we are inserting records. Finally, after the transfer we are releasing the records.