Thứ Năm, 17 tháng 4, 2014

RECOVERY EXCHANGE SERVER 2007 (PART 1)



RECOVERY EXCHANGE SERVER 2007 (PART 1)
I.      Giới thiệu:
Bạn là nhân viên quản trị hệ thống mail server Exchange 2007 của công ty. Hệ thống luôn được thực hiện backup định kỳ theo đúng kế hoạch. Vì lý do về phần cứng mà mail server của công ty không thể hoạt động được, bạn cần thay mail server mới và phục hồi lại tất cả mailbox của user, nhanh chóng đưa mail server mới vào làm việc, để giảm thiểu thời gian gián đoạn của hệ thống.
Bài viết này giới thiệu các bước thay thế server mới và phục hồi lại hệ thống mail exchange server 2007 của công ty, một cách nhanh chóng và hạn chế tối đa việc mất mail của user. 
Phần 1 của bài viết này giới thiệu cách phục hồi exchange server 2007 trong hệ thống có Domain controller và Exchange server 2007 đươc cài trên hai server riêng. Phần 2 sẽ giới thiệu cách phục hồi  exchange server 2007 trong hệ thống có Domain controller và Exchange server 2007 được cài chung trên một server.
Bài viết này có thể thực hiện cho Exchange 2007, Exchange 2007 Sp1, Exchange 2007 Sp2.
II.   Chuẩn Bị:
Hệ thống bao gồm một máy domain controller chạy windows server 2003 sp1, một máy Exchange server 2007.
Giả lập máy Exchange 2007 bị hư có thể do đĩa cứng hay các lý do khác, cần phải thay đĩa cứng hay server khác.
Mô hình:
Các bước thực hiện:
A.   Backup MailBox Database định kỳ.
B.   Thay server mới
C.   Restore MailBox Database
III.     Thực hiện:
A.   Backup MailBox Database định kỳ:
1.     Các User hiện có trong hệ thống mail. ( hệ thống mail đang làm việc bình thường)
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image002.jpg
2.     Gửi nhận mail trước khi backup:
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image004.jpg
3.     Tiến hành backup database định kỳ, vào Start Run gõ lệnh NTBACKUP:
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image005.jpg
4.     Welcome ấn next:
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image006.jpg
5.     Chọn Option Back up files and settings, ấn next.
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image007.jpg
6.     Chọn Let me choose what to back up, ấn next.
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image008.jpg
7.     Đánh dấu chọn Microsoft Information Store
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image009.jpg
8.     Chọn nơi lưu file backup, ấn next sau đó ấn finish. Sau khi backup xong file này được lưu lên máy domain (lưu trữ sang nơi khác dự phòng khi có sự cố)
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image010.jpg
9.       Hoàn tất backup
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image011.jpg
10.   Pcname và Ip của Mail server trước khi bị hư đĩa cứng:
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image012.jpg 

http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image013.jpg
B.   Thay thế Server mới: (giả lập Mail Server bị hư đĩa cứng, cần phục hồi lại hệ thống mail như ban đầu sau khi thay đĩa cứng mới)
1.     Trên máy domain vào DSA.MSC, phải chuột vào PCname của exchange server ấn Reset Account:
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image014.jpg
2.     Trên Mail server mới khai báo Pcname và Ip giống server cũ trước khi bị hư. Sau đó khởi động lại rồi tiến hành join vào domain.
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image013.jpg
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image015.jpg
3.     Logon vào server mới với quyền Domain Administrator, Cài các dịch vụ như IIS, APS.net, Net framework 2.0, MMC 3.0 và Power shell trước khi phục hồi lại mail server.
4.     Tại nơi chứa source exchange 2007 gõ lệnh: Setup /M:RecoverServer
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image017.jpg
Việc setup này thực hiện trong khoảng 15 đến 20 phút.
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image018.jpg
5.     Sau khi setup xong, vào Exchange Management Console, tất cả mọi user đã có lại nhưng chưa có mail.
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image019.jpg
C. Restore MailBox Database:
1.     Trước khi Restore lại mailbox, phải chuột vào mailbox database chọn properties.
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image020.jpg
2.     Check vào check box This database can be overwritten  by a restore, OK
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image021.jpg
3.     Copy file backup từ máy domain về máy Mail Server
4.     Vào Start run gõ NTBACKUP, màn hình welcome ấn next.
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image006.jpg
5.     Chọn Restore files and settings, ấn next
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image022.jpg
6.     Ấn Browse chọn file MailEx.bkf mới copy từ máy domain về,
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image023.jpg
7.     lưu file log vào c:\temp, check vào 2 check box Last restore set và Mount Database after Restore, next, và finish.
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image024.jpg
8.     Hoàn tất việc Restore mailbox database
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image025.jpg
9.     Kiểm tra mail của user sau khi restore, logon vào user để kiểm tra
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image026.jpg
10.            Tất cả các mail đã được phục hồi lại như ban đầu.
http://loc.nhatnghe.vn/ReCoverEX/RecoverEX_files/image028.jpg
Việc thay thế server mới trong hệ thống mạng là việc làm không thể trách khỏi, có  rất nhiều lý do để người quản trị hệ thống phải thay server mới. Nhưng với bất kỳ lý do gì thì hệ thống phải được làm việc trở lại nhanh chóng, an toàn và hiệu quả, Hy vọng bài viết giúp cho các bạn có thêm giải pháp trong kế hoạch thay thế server mới.
Chúc các bạn thành công
Chung Tấn Lộc
 

Thứ Tư, 16 tháng 4, 2014

How to Use MySQL GRANT to Grant Privileges to Account



 » MySQL Adminsitration » How to Use MySQL GRANT to Grant Privileges to Account
How to Use MySQL GRANT to Grant Privileges to Account
Summary: In this tutorial, you will learn how to use MySQL GRANT statement to grant privileges to accounts. In order to follow this tutorial, we recommend that you read the ‘Getting started with MySQL access control system" and "How to create a user in MySQL" tutorials first.
MySQL GRANT Statement Explained
In order to give access privileges to an account, you use the MySQL GRANT statement with the syntax as follows:
1
GRANT privileges (column_list)
2
ON [object_type] privilege_level

3
TO account [IDENTIFIED BY 'password']
4
[REQUIRE encryption]

5
WITH with_options
If the account exists, MySQL modifies its privileges. If account does not exist, GRANT statement creates a new account with the specified privileges. Besides granting privileges to the account, the GRANT statement also sets other account's characteristics such as limit on access to the database server resources and use secure connection. If you want to grant a privilege to an account, you must have that privilege and GRANT OPTION privilege. We will examine the MySQL GRANT statement in detail as follows:
  • privileges indicates the privileges to assign to the account. For example the CREATE privilege allows user to create database and tables. You can assign multiple privileges at a time. Each privilege is separated by a comma. You can use the privileges in the table 1.1 below.
  • column_list specifies the columns to which a privilege applies. Each column is separated by commas and listed within parentheses. The column_list is optional.
  • privilege_level specifies the level at which the privileges apply. You can use global privileges, database-specific privileges, table-specific privileges, column-specific privileges…
  • account specifies which account is being granted the privileges.
  • password specifies the password to assign to the account. If the account exists, the GRANT statement replaces the old password. Like the CREATE USER statement, you use plaintext password followed by the IDENTIFIED BY. The IDENTIFIED BY clause is optional.
  • After the REQUIRE clause, you specifies whether the user has to connect to the database server over secure connection using SSL.
  • If you want the account to have the privilege to grant its own privileges to other accounts, you need to use WITH with GRANT OPTION. In addition, WITH clause is used to allocate the database server's resource that enable you to set how many connections or statements an account can use per hour.
The MySQL GRANT statement is normally used with the CREATE USER statement. You create a new user first before granting privileges to that user.
Examples with MySQL GRANT
Let's practice with some examples to have a better understanding of MySQL GRANT statement. If you want to create a superuser account that can do anything including being able to grant privileges to other user you can use the following queries:
1
CREATE USER 'super'@'localhost' IDENTIFIED BY 'SecurePass1';
2


3
GRANT ALL ON *.* TO 'super'@'localhost' WITH GRANT OPTION;
The ON *.* clause means all databases and all objects in them. The only limit here is that super can only connect to the database server from localhost, which makes the server more secured. To create a user that has all access in our sample database classicmodels and can connect from any host you use the following queries:
1
CREATE USER 'super2'@'%' IDENTIFIED BY 'SecurePass2';
2


3
GRANT ALL classicmodels.* TO 'super2'@'%' WITH GRANT OPTION;
You can grant multiple privileges at a time; a comma separates each privilege. For example, you can create a user to use SELECT, INSERT and UPDATE statements on our sample database classicmodels, you can use the following queries:
1
CREATE USER 'rfc'@'%' IDENTIFIED BY 'SecurePass3';
2


3
GRANT SELECT, UPDATE, DELETE ON  classicmodels.* TO 'rfc'@'%';
Available privileges to use with MySQL GRANT
Here is the table that lists all the available privileges in MySQL
Privilege
Description
ALL [PRIVILEGES]
Grant all privileges at specified access level except GRANT OPTION
ALTER
Allow to use of ALTER TABLE statement
ALTER ROUTINE
Allow user to alter or drop stored routine
CREATE
Allow user to create database and table
CREATE ROUTINE
Allow user to create stored routine
CREATE TABLESPACE
Allow user to create, alter or drop tablespaces and log file groups
CREATE TEMPORARY TABLES
Allow user to create temporary table by using CREATE TEMPORARY TABLE
CREATE USER
Allow user to use the CREATE USER, DROP USER, RENAME USER, and REVOKE ALL PRIVILEGES statements.
CREATE VIEW
Allow user to create or modify view
DELETE
Allow user to use DELETE
DROP
Allow user to drop database, table and view
EVENT
Allow user to schedule events in Event Scheduler
EXECUTE
Allow user to execute stored routines
FILE
Allow user to read any file in the database directory.
GRANT OPTION
Allow user to have privileges to grant or revoke privileges from other accounts
INDEX
Allow user to create or remove indexes.
INSERT
Allow user to use INSERT statement
LOCK TABLES
Allow user to use LOCK TABLES on tables for which you have the SELECT privilege
PROCESS
Allow user to see all processes with SHOW PROCESSLIST statement.
PROXY
Enable user proxying
REFERENCES
Not implemented
RELOAD
Allow user to use FLUSH operations
REPLICATION CLIENT
Allow user to query to see where master or slave servers are
REPLICATION SLAVE
Allow user to use replicate slaves to read binary log events from the master.
SELECT
Allow user to use SELECT statement
SHOW DATABASES
Allow user to show all databases
SHOW VIEW
Allow user to use SHOW CREATE VIEW statement
SHUTDOWN
Allow user to use mysqladmin shutdown command
SUPER
Allow user to use other administrative operations such as CHANGE MASTER TO, KILL, PURGE BINARY LOGS, SET GLOBAL, and mysqladmin command
TRIGGER
Allow user to use TRIGGER operations.
UPDATE
Allow user to use UPDATE statement
USAGE
Equivalent to “no privileges”
Table 1.1
In this tutorial, you've learned how to use MySQL GRANT statement to grant various privileges to users with different options.