August 2025
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories

August 2025
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

rhel7 root user password cracking

Edit current kernel version into the grub menu bar, and finally add rd.break parameters linux6

linux16 /vmlinuz-3.10.0-327.el7.x86_64 root=/dev/mapper/rhel-root ro rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet rd.break
Use ctrl + x to reboot the system to start

Remount the ‘root’ file system, and change into the / sysroot

mount -oremount,rw /sysroot
chroot /sysroot
Changing the root password

echo “RedHat” | passwd –stdin root
Create /.autorelabel file, skip selinux certification

touch /.autorelabel
grub configuration file encryption
Use grub2-mkpasswd-pbkdf2 command to add grub secret key authentication.

[root@rmohan ~]# grub2-mkpasswd-pbkdf2
Enter password:
Reenter password:
PBKDF2 hash of your password is grub.pbkdf2.sha512.10000.02A9678D83F863EFAEAAD08E9280D74B5D559577A4D3B6sad52C633053315266B5E883B626413664CAA835A7CDD2A5239ED6CB82D7AEA74127143685E9081E463C652C633053315266B5E883B626413664CAA835A7CDD2A5239ED6CB82D7AEA74127143685E9081E463C6.F49B8110AF0D29B0BE98322D5911824BC9F9DBB4204F71699519484FD288FDF92B58588A108AFE79479F1DB35EE60C144226DE3127F3CBBC68988786AAC69379
Edit /etc/grub.d/00_header the file add. Note that the user may not be present in the root system.

cat << EOF
set superusers=”root”
password_pbkdf2 rootgrub.pbkdf2.sha512.10000.02A9678D83F863EFAEAAD08E9280D74B5D559577A4D3B652C633053315266B5E883B626413664CAA835A7CDD2A5239ED6CB82D7AEA74127143685E9081E463C6.F49B8110AF0D29B0BE98322D5911824BC9F9DBB4204F71699519484FD288FDF92B58588A108AFE79479F1DB35EE60C144226DE3127F3CBBC68988786AAC69379
EOF
Update the grub configuration file to take effect

grub2-mkconfig >> /boot/grub2/grub.cfg

Booting into single user mode and changing root password Centos / Redhat 7

During boot, press “e” at the grub loader.
Scroll down using the arrow keys to the line starting with “linux”. It would look like this.
linux16 /vmlinuz-3.10.0……
Remove the following from that line. “rhgb” and “quiet“.
Add the following to the end of the line. “init=/bin/sh“.
Press ctrl+x to continue the boot process.
Once the system is booted, you will be at the root user in single user mode. But this is in a read only file system.
You need to mount the / filesystem.
mount -o remount, rw /
Test that you can write to /, following command should work without error.
touch /tmp/test
Now change your password for root
passwd
Touch the following file to make sure things are ok on SELinux, this is a fix file process.
touch /.autorelabel
Finally start the normal boot process.
exec /sbin/init

You’re Done.

MariaDB centos 7

[root@clusterserver1 ~]# yum -y install mariadb mariadb-server
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base                                                                                                                                                                               | 3.6 kB  00:00:00
epel/x86_64/metalink                                                                                                                                                               | 3.9 kB  00:00:00
epel                                                                                                                                                                               | 4.3 kB  00:00:00
extras                                                                                                                                                                             | 3.4 kB  00:00:00
updates                                                                                                                                                                            | 3.4 kB  00:00:00
(1/4): extras/7/x86_64/primary_db                                                                                                                                                  | 101 kB  00:00:00
(2/4): epel/x86_64/updateinfo                                                                                                                                                      | 523 kB  00:00:01
(3/4): updates/7/x86_64/primary_db                                                                                                                                                 | 3.2 MB  00:00:02
(4/4): epel/x86_64/primary_db                                                                                                                                                      | 4.0 MB  00:00:04
Determining fastest mirrors
* base: mirror.vastspace.net
* epel: mirror01.idc.hinet.net
* extras: mirror.vastspace.net
* updates: mirror.vastspace.net
Resolving Dependencies
–> Running transaction check
—> Package mariadb.x86_64 1:5.5.44-2.el7.centos will be installed
–> Processing Dependency: perl(Sys::Hostname) for package: 1:mariadb-5.5.44-2.el7.centos.x86_64
–> Processing Dependency: perl(IPC::Open3) for package: 1:mariadb-5.5.44-2.el7.centos.x86_64
–> Processing Dependency: perl(Getopt::Long) for package: 1:mariadb-5.5.44-2.el7.centos.x86_64
–> Processing Dependency: perl(File::Temp) for package: 1:mariadb-5.5.44-2.el7.centos.x86_64
–> Processing Dependency: perl(Fcntl) for package: 1:mariadb-5.5.44-2.el7.centos.x86_64
–> Processing Dependency: perl(Exporter) for package: 1:mariadb-5.5.44-2.el7.centos.x86_64
–> Processing Dependency: /usr/bin/perl for package: 1:mariadb-5.5.44-2.el7.centos.x86_64
—> Package mariadb-server.x86_64 1:5.5.44-2.el7.centos will be installed
–> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.44-2.el7.centos.x86_64
–> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.44-2.el7.centos.x86_64
–> Processing Dependency: perl(File::Path) for package: 1:mariadb-server-5.5.44-2.el7.centos.x86_64
–> Processing Dependency: perl(Data::Dumper) for package: 1:mariadb-server-5.5.44-2.el7.centos.x86_64
–> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.44-2.el7.centos.x86_64
–> Running transaction check
—> Package perl.x86_64 4:5.16.3-286.el7 will be installed
–> Processing Dependency: perl-libs = 4:5.16.3-286.el7 for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(Socket) >= 1.3 for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(Scalar::Util) >= 1.10 for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl-macros for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl-libs for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(threads::shared) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(threads) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(constant) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(Time::Local) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(Time::HiRes) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(Storable) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(Socket) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(Scalar::Util) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(Pod::Simple::XHTML) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(Pod::Simple::Search) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(Filter::Util::Call) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(File::Spec::Unix) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(File::Spec::Functions) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(File::Spec) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(Cwd) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: perl(Carp) for package: 4:perl-5.16.3-286.el7.x86_64
–> Processing Dependency: libperl.so()(64bit) for package: 4:perl-5.16.3-286.el7.x86_64
—> Package perl-DBD-MySQL.x86_64 0:4.023-5.el7 will be installed
—> Package perl-DBI.x86_64 0:1.627-4.el7 will be installed
–> Processing Dependency: perl(RPC::PlServer) >= 0.2001 for package: perl-DBI-1.627-4.el7.x86_64
–> Processing Dependency: perl(RPC::PlClient) >= 0.2000 for package: perl-DBI-1.627-4.el7.x86_64
—> Package perl-Data-Dumper.x86_64 0:2.145-3.el7 will be installed
—> Package perl-Exporter.noarch 0:5.68-3.el7 will be installed
—> Package perl-File-Path.noarch 0:2.09-2.el7 will be installed
—> Package perl-File-Temp.noarch 0:0.23.01-3.el7 will be installed
—> Package perl-Getopt-Long.noarch 0:2.40-2.el7 will be installed
–> Processing Dependency: perl(Pod::Usage) >= 1.14 for package: perl-Getopt-Long-2.40-2.el7.noarch
–> Processing Dependency: perl(Text::ParseWords) for package: perl-Getopt-Long-2.40-2.el7.noarch
–> Running transaction check
—> Package perl-Carp.noarch 0:1.26-244.el7 will be installed
—> Package perl-Filter.x86_64 0:1.49-3.el7 will be installed
—> Package perl-PathTools.x86_64 0:3.40-5.el7 will be installed
—> Package perl-PlRPC.noarch 0:0.2020-14.el7 will be installed
–> Processing Dependency: perl(Net::Daemon) >= 0.13 for package: perl-PlRPC-0.2020-14.el7.noarch
–> Processing Dependency: perl(Net::Daemon::Test) for package: perl-PlRPC-0.2020-14.el7.noarch
–> Processing Dependency: perl(Net::Daemon::Log) for package: perl-PlRPC-0.2020-14.el7.noarch
–> Processing Dependency: perl(Compress::Zlib) for package: perl-PlRPC-0.2020-14.el7.noarch
—> Package perl-Pod-Simple.noarch 1:3.28-4.el7 will be installed
–> Processing Dependency: perl(Pod::Escapes) >= 1.04 for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
–> Processing Dependency: perl(Encode) for package: 1:perl-Pod-Simple-3.28-4.el7.noarch
—> Package perl-Pod-Usage.noarch 0:1.63-3.el7 will be installed
–> Processing Dependency: perl(Pod::Text) >= 3.15 for package: perl-Pod-Usage-1.63-3.el7.noarch
–> Processing Dependency: perl-Pod-Perldoc for package: perl-Pod-Usage-1.63-3.el7.noarch
—> Package perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 will be installed
—> Package perl-Socket.x86_64 0:2.010-3.el7 will be installed
—> Package perl-Storable.x86_64 0:2.45-3.el7 will be installed
—> Package perl-Text-ParseWords.noarch 0:3.29-4.el7 will be installed
—> Package perl-Time-HiRes.x86_64 4:1.9725-3.el7 will be installed
—> Package perl-Time-Local.noarch 0:1.2300-2.el7 will be installed
—> Package perl-constant.noarch 0:1.27-2.el7 will be installed
—> Package perl-libs.x86_64 4:5.16.3-286.el7 will be installed
—> Package perl-macros.x86_64 4:5.16.3-286.el7 will be installed
—> Package perl-threads.x86_64 0:1.87-4.el7 will be installed
—> Package perl-threads-shared.x86_64 0:1.43-6.el7 will be installed
–> Running transaction check
—> Package perl-Encode.x86_64 0:2.51-7.el7 will be installed
—> Package perl-IO-Compress.noarch 0:2.061-2.el7 will be installed
–> Processing Dependency: perl(Compress::Raw::Zlib) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
–> Processing Dependency: perl(Compress::Raw::Bzip2) >= 2.061 for package: perl-IO-Compress-2.061-2.el7.noarch
—> Package perl-Net-Daemon.noarch 0:0.48-5.el7 will be installed
—> Package perl-Pod-Escapes.noarch 1:1.04-286.el7 will be installed
—> Package perl-Pod-Perldoc.noarch 0:3.20-4.el7 will be installed
–> Processing Dependency: perl(parent) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
–> Processing Dependency: perl(HTTP::Tiny) for package: perl-Pod-Perldoc-3.20-4.el7.noarch
—> Package perl-podlators.noarch 0:2.5.1-3.el7 will be installed
–> Running transaction check
—> Package perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7 will be installed
—> Package perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 will be installed
—> Package perl-HTTP-Tiny.noarch 0:0.033-3.el7 will be installed
—> Package perl-parent.noarch 1:0.225-244.el7 will be installed
–> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================================================================
Package                                                   Arch                                     Version                                                  Repository                              Size
==========================================================================================================================================================================================================
Installing:
mariadb                                                   x86_64                                   1:5.5.44-2.el7.centos                                    base                                   8.9 M
mariadb-server                                            x86_64                                   1:5.5.44-2.el7.centos                                    base                                    11 M
Installing for dependencies:
perl                                                      x86_64                                   4:5.16.3-286.el7                                         base                                   8.0 M
perl-Carp                                                 noarch                                   1.26-244.el7                                             base                                    19 k
perl-Compress-Raw-Bzip2                                   x86_64                                   2.061-3.el7                                              base                                    32 k
perl-Compress-Raw-Zlib                                    x86_64                                   1:2.061-4.el7                                            base                                    57 k
perl-DBD-MySQL                                            x86_64                                   4.023-5.el7                                              base                                   140 k
perl-DBI                                                  x86_64                                   1.627-4.el7                                              base                                   802 k
perl-Data-Dumper                                          x86_64                                   2.145-3.el7                                              base                                    47 k
perl-Encode                                               x86_64                                   2.51-7.el7                                               base                                   1.5 M
perl-Exporter                                             noarch                                   5.68-3.el7                                               base                                    28 k
perl-File-Path                                            noarch                                   2.09-2.el7                                               base                                    26 k
perl-File-Temp                                            noarch                                   0.23.01-3.el7                                            base                                    56 k
perl-Filter                                               x86_64                                   1.49-3.el7                                               base                                    76 k
perl-Getopt-Long                                          noarch                                   2.40-2.el7                                               base                                    56 k
perl-HTTP-Tiny                                            noarch                                   0.033-3.el7                                              base                                    38 k
perl-IO-Compress                                          noarch                                   2.061-2.el7                                              base                                   260 k
perl-Net-Daemon                                           noarch                                   0.48-5.el7                                               base                                    51 k
perl-PathTools                                            x86_64                                   3.40-5.el7                                               base                                    82 k
perl-PlRPC                                                noarch                                   0.2020-14.el7                                            base                                    36 k
perl-Pod-Escapes                                          noarch                                   1:1.04-286.el7                                           base                                    50 k
perl-Pod-Perldoc                                          noarch                                   3.20-4.el7                                               base                                    87 k
perl-Pod-Simple                                           noarch                                   1:3.28-4.el7                                             base                                   216 k
perl-Pod-Usage                                            noarch                                   1.63-3.el7                                               base                                    27 k
perl-Scalar-List-Utils                                    x86_64                                   1.27-248.el7                                             base                                    36 k
perl-Socket                                               x86_64                                   2.010-3.el7                                              base                                    49 k
perl-Storable                                             x86_64                                   2.45-3.el7                                               base                                    77 k
perl-Text-ParseWords                                      noarch                                   3.29-4.el7                                               base                                    14 k
perl-Time-HiRes                                           x86_64                                   4:1.9725-3.el7                                           base                                    45 k
perl-Time-Local                                           noarch                                   1.2300-2.el7                                             base                                    24 k
perl-constant                                             noarch                                   1.27-2.el7                                               base                                    19 k
perl-libs                                                 x86_64                                   4:5.16.3-286.el7                                         base                                   687 k
perl-macros                                               x86_64                                   4:5.16.3-286.el7                                         base                                    43 k
perl-parent                                               noarch                                   1:0.225-244.el7                                          base                                    12 k
perl-podlators                                            noarch                                   2.5.1-3.el7                                              base                                   112 k
perl-threads                                              x86_64                                   1.87-4.el7                                               base                                    49 k
perl-threads-shared                                       x86_64                                   1.43-6.el7                                               base                                    39 k

Transaction Summary
==========================================================================================================================================================================================================
Install  2 Packages (+35 Dependent packages)

Total download size: 32 M
Installed size: 144 M
Downloading packages:
(1/37): perl-Carp-1.26-244.el7.noarch.rpm                                                                                                                                          |  19 kB  00:00:00
(2/37): perl-Compress-Raw-Zlib-2.061-4.el7.x86_64.rpm                                                                                                                              |  57 kB  00:00:00
(3/37): perl-DBD-MySQL-4.023-5.el7.x86_64.rpm                                                                                                                                      | 140 kB  00:00:00
(4/37): perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64.rpm                                                                                                                             |  32 kB  00:00:00
(5/37): perl-Data-Dumper-2.145-3.el7.x86_64.rpm                                                                                                                                    |  47 kB  00:00:00
(6/37): perl-DBI-1.627-4.el7.x86_64.rpm                                                                                                                                            | 802 kB  00:00:00
(7/37): perl-Exporter-5.68-3.el7.noarch.rpm                                                                                                                                        |  28 kB  00:00:00
(8/37): perl-File-Path-2.09-2.el7.noarch.rpm                                                                                                                                       |  26 kB  00:00:00
(9/37): perl-File-Temp-0.23.01-3.el7.noarch.rpm                                                                                                                                    |  56 kB  00:00:00
(10/37): perl-Filter-1.49-3.el7.x86_64.rpm                                                                                                                                         |  76 kB  00:00:00
(11/37): perl-Getopt-Long-2.40-2.el7.noarch.rpm                                                                                                                                    |  56 kB  00:00:00
(12/37): perl-HTTP-Tiny-0.033-3.el7.noarch.rpm                                                                                                                                     |  38 kB  00:00:00
(13/37): perl-IO-Compress-2.061-2.el7.noarch.rpm                                                                                                                                   | 260 kB  00:00:00
(14/37): perl-Net-Daemon-0.48-5.el7.noarch.rpm                                                                                                                                     |  51 kB  00:00:00
(15/37): perl-PathTools-3.40-5.el7.x86_64.rpm                                                                                                                                      |  82 kB  00:00:00
(16/37): perl-PlRPC-0.2020-14.el7.noarch.rpm                                                                                                                                       |  36 kB  00:00:00
(17/37): perl-Pod-Escapes-1.04-286.el7.noarch.rpm                                                                                                                                  |  50 kB  00:00:00
(18/37): perl-Pod-Perldoc-3.20-4.el7.noarch.rpm                                                                                                                                    |  87 kB  00:00:00
(19/37): perl-Pod-Simple-3.28-4.el7.noarch.rpm                                                                                                                                     | 216 kB  00:00:00
(20/37): perl-Pod-Usage-1.63-3.el7.noarch.rpm                                                                                                                                      |  27 kB  00:00:00
(21/37): perl-Scalar-List-Utils-1.27-248.el7.x86_64.rpm                                                                                                                            |  36 kB  00:00:00
(22/37): perl-Socket-2.010-3.el7.x86_64.rpm                                                                                                                                        |  49 kB  00:00:00
(23/37): perl-Storable-2.45-3.el7.x86_64.rpm                                                                                                                                       |  77 kB  00:00:00
(24/37): perl-Text-ParseWords-3.29-4.el7.noarch.rpm                                                                                                                                |  14 kB  00:00:00
(25/37): perl-Time-HiRes-1.9725-3.el7.x86_64.rpm                                                                                                                                   |  45 kB  00:00:00
(26/37): perl-Time-Local-1.2300-2.el7.noarch.rpm                                                                                                                                   |  24 kB  00:00:00
(27/37): perl-constant-1.27-2.el7.noarch.rpm                                                                                                                                       |  19 kB  00:00:00
(28/37): perl-libs-5.16.3-286.el7.x86_64.rpm                                                                                                                                       | 687 kB  00:00:00
(29/37): perl-macros-5.16.3-286.el7.x86_64.rpm                                                                                                                                     |  43 kB  00:00:00
(30/37): perl-parent-0.225-244.el7.noarch.rpm                                                                                                                                      |  12 kB  00:00:00
(31/37): perl-podlators-2.5.1-3.el7.noarch.rpm                                                                                                                                     | 112 kB  00:00:00
(32/37): perl-threads-1.87-4.el7.x86_64.rpm                                                                                                                                        |  49 kB  00:00:00
(33/37): perl-Encode-2.51-7.el7.x86_64.rpm                                                                                                                                         | 1.5 MB  00:00:05
(34/37): perl-threads-shared-1.43-6.el7.x86_64.rpm                                                                                                                                 |  39 kB  00:00:00
(35/37): perl-5.16.3-286.el7.x86_64.rpm                                                                                                                                            | 8.0 MB  00:00:07
(36/37): mariadb-5.5.44-2.el7.centos.x86_64.rpm                                                                                                                                    | 8.9 MB  00:00:07
(37/37): mariadb-server-5.5.44-2.el7.centos.x86_64.rpm                                                                                                                             |  11 MB  00:00:12
———————————————————————————————————————————————————————————————————-
Total                                                                                                                                                                     2.6 MB/s |  32 MB  00:00:12
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:perl-parent-0.225-244.el7.noarch                                                                                                                                                    1/37
Installing : perl-HTTP-Tiny-0.033-3.el7.noarch                                                                                                                                                     2/37
Installing : perl-podlators-2.5.1-3.el7.noarch                                                                                                                                                     3/37
Installing : perl-Pod-Perldoc-3.20-4.el7.noarch                                                                                                                                                    4/37
Installing : 1:perl-Pod-Escapes-1.04-286.el7.noarch                                                                                                                                                5/37
Installing : perl-Text-ParseWords-3.29-4.el7.noarch                                                                                                                                                6/37
Installing : perl-Encode-2.51-7.el7.x86_64                                                                                                                                                         7/37
Installing : perl-Pod-Usage-1.63-3.el7.noarch                                                                                                                                                      8/37
Installing : 4:perl-libs-5.16.3-286.el7.x86_64                                                                                                                                                     9/37
Installing : 4:perl-macros-5.16.3-286.el7.x86_64                                                                                                                                                  10/37
Installing : perl-Storable-2.45-3.el7.x86_64                                                                                                                                                      11/37
Installing : perl-Exporter-5.68-3.el7.noarch                                                                                                                                                      12/37
Installing : perl-constant-1.27-2.el7.noarch                                                                                                                                                      13/37
Installing : perl-Time-Local-1.2300-2.el7.noarch                                                                                                                                                  14/37
Installing : perl-Socket-2.010-3.el7.x86_64                                                                                                                                                       15/37
Installing : perl-Carp-1.26-244.el7.noarch                                                                                                                                                        16/37
Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                                                                                                                                                17/37
Installing : perl-PathTools-3.40-5.el7.x86_64                                                                                                                                                     18/37
Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64                                                                                                                                           19/37
Installing : perl-File-Temp-0.23.01-3.el7.noarch                                                                                                                                                  20/37
Installing : perl-File-Path-2.09-2.el7.noarch                                                                                                                                                     21/37
Installing : perl-threads-shared-1.43-6.el7.x86_64                                                                                                                                                22/37
Installing : perl-threads-1.87-4.el7.x86_64                                                                                                                                                       23/37
Installing : perl-Filter-1.49-3.el7.x86_64                                                                                                                                                        24/37
Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch                                                                                                                                                  25/37
Installing : perl-Getopt-Long-2.40-2.el7.noarch                                                                                                                                                   26/37
Installing : 4:perl-5.16.3-286.el7.x86_64                                                                                                                                                         27/37
Installing : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                                                                  28/37
Installing : 1:mariadb-5.5.44-2.el7.centos.x86_64                                                                                                                                                 29/37
Installing : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                                                                                                           30/37
Installing : perl-Net-Daemon-0.48-5.el7.noarch                                                                                                                                                    31/37
Installing : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                                                                                                          32/37
Installing : perl-IO-Compress-2.061-2.el7.noarch                                                                                                                                                  33/37
Installing : perl-PlRPC-0.2020-14.el7.noarch                                                                                                                                                      34/37
Installing : perl-DBI-1.627-4.el7.x86_64                                                                                                                                                          35/37
Installing : perl-DBD-MySQL-4.023-5.el7.x86_64                                                                                                                                                    36/37
Installing : 1:mariadb-server-5.5.44-2.el7.centos.x86_64                                                                                                                                          37/37
Verifying  : perl-HTTP-Tiny-0.033-3.el7.noarch                                                                                                                                                     1/37
Verifying  : 1:mariadb-5.5.44-2.el7.centos.x86_64                                                                                                                                                  2/37
Verifying  : 1:mariadb-server-5.5.44-2.el7.centos.x86_64                                                                                                                                           3/37
Verifying  : perl-Storable-2.45-3.el7.x86_64                                                                                                                                                       4/37
Verifying  : perl-IO-Compress-2.061-2.el7.noarch                                                                                                                                                   5/37
Verifying  : perl-Exporter-5.68-3.el7.noarch                                                                                                                                                       6/37
Verifying  : perl-constant-1.27-2.el7.noarch                                                                                                                                                       7/37
Verifying  : perl-PathTools-3.40-5.el7.x86_64                                                                                                                                                      8/37
Verifying  : 4:perl-libs-5.16.3-286.el7.x86_64                                                                                                                                                     9/37
Verifying  : 4:perl-macros-5.16.3-286.el7.x86_64                                                                                                                                                  10/37
Verifying  : perl-Compress-Raw-Bzip2-2.061-3.el7.x86_64                                                                                                                                           11/37
Verifying  : 1:perl-parent-0.225-244.el7.noarch                                                                                                                                                   12/37
Verifying  : perl-Net-Daemon-0.48-5.el7.noarch                                                                                                                                                    13/37
Verifying  : 4:perl-5.16.3-286.el7.x86_64                                                                                                                                                         14/37
Verifying  : perl-File-Temp-0.23.01-3.el7.noarch                                                                                                                                                  15/37
Verifying  : 1:perl-Pod-Simple-3.28-4.el7.noarch                                                                                                                                                  16/37
Verifying  : perl-Time-Local-1.2300-2.el7.noarch                                                                                                                                                  17/37
Verifying  : perl-Pod-Perldoc-3.20-4.el7.noarch                                                                                                                                                   18/37
Verifying  : perl-DBI-1.627-4.el7.x86_64                                                                                                                                                          19/37
Verifying  : perl-Socket-2.010-3.el7.x86_64                                                                                                                                                       20/37
Verifying  : perl-Carp-1.26-244.el7.noarch                                                                                                                                                        21/37
Verifying  : perl-Data-Dumper-2.145-3.el7.x86_64                                                                                                                                                  22/37
Verifying  : perl-threads-shared-1.43-6.el7.x86_64                                                                                                                                                23/37
Verifying  : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                                                                                                                                                24/37
Verifying  : perl-Scalar-List-Utils-1.27-248.el7.x86_64                                                                                                                                           25/37
Verifying  : 1:perl-Compress-Raw-Zlib-2.061-4.el7.x86_64                                                                                                                                          26/37
Verifying  : perl-PlRPC-0.2020-14.el7.noarch                                                                                                                                                      27/37
Verifying  : 1:perl-Pod-Escapes-1.04-286.el7.noarch                                                                                                                                               28/37
Verifying  : perl-Pod-Usage-1.63-3.el7.noarch                                                                                                                                                     29/37
Verifying  : perl-DBD-MySQL-4.023-5.el7.x86_64                                                                                                                                                    30/37
Verifying  : perl-Encode-2.51-7.el7.x86_64                                                                                                                                                        31/37
Verifying  : perl-podlators-2.5.1-3.el7.noarch                                                                                                                                                    32/37
Verifying  : perl-Getopt-Long-2.40-2.el7.noarch                                                                                                                                                   33/37
Verifying  : perl-File-Path-2.09-2.el7.noarch                                                                                                                                                     34/37
Verifying  : perl-threads-1.87-4.el7.x86_64                                                                                                                                                       35/37
Verifying  : perl-Filter-1.49-3.el7.x86_64                                                                                                                                                        36/37
Verifying  : perl-Text-ParseWords-3.29-4.el7.noarch                                                                                                                                               37/37

Installed:
mariadb.x86_64 1:5.5.44-2.el7.centos                                                             mariadb-server.x86_64 1:5.5.44-2.el7.centos

Dependency Installed:
perl.x86_64 4:5.16.3-286.el7                 perl-Carp.noarch 0:1.26-244.el7                  perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7         perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7
perl-DBD-MySQL.x86_64 0:4.023-5.el7          perl-DBI.x86_64 0:1.627-4.el7                    perl-Data-Dumper.x86_64 0:2.145-3.el7                perl-Encode.x86_64 0:2.51-7.el7
perl-Exporter.noarch 0:5.68-3.el7            perl-File-Path.noarch 0:2.09-2.el7               perl-File-Temp.noarch 0:0.23.01-3.el7                perl-Filter.x86_64 0:1.49-3.el7
perl-Getopt-Long.noarch 0:2.40-2.el7         perl-HTTP-Tiny.noarch 0:0.033-3.el7              perl-IO-Compress.noarch 0:2.061-2.el7                perl-Net-Daemon.noarch 0:0.48-5.el7
perl-PathTools.x86_64 0:3.40-5.el7           perl-PlRPC.noarch 0:0.2020-14.el7                perl-Pod-Escapes.noarch 1:1.04-286.el7               perl-Pod-Perldoc.noarch 0:3.20-4.el7
perl-Pod-Simple.noarch 1:3.28-4.el7          perl-Pod-Usage.noarch 0:1.63-3.el7               perl-Scalar-List-Utils.x86_64 0:1.27-248.el7         perl-Socket.x86_64 0:2.010-3.el7
perl-Storable.x86_64 0:2.45-3.el7            perl-Text-ParseWords.noarch 0:3.29-4.el7         perl-Time-HiRes.x86_64 4:1.9725-3.el7                perl-Time-Local.noarch 0:1.2300-2.el7
perl-constant.noarch 0:1.27-2.el7            perl-libs.x86_64 4:5.16.3-286.el7                perl-macros.x86_64 4:5.16.3-286.el7                  perl-parent.noarch 1:0.225-244.el7
perl-podlators.noarch 0:2.5.1-3.el7          perl-threads.x86_64 0:1.87-4.el7                 perl-threads-shared.x86_64 0:1.43-6.el7

Complete!
[root@clusterserver1 ~]# systemctl start mariadb
[root@clusterserver1 ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@clusterserver1 ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we’ll need the current
password for the root user.  If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
… Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
… Success!

Normally, root should only be allowed to connect from ‘localhost’.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
… Success!

By default, MariaDB comes with a database named ‘test’ that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
… Success!

Cleaning up…

All done!  If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!
[root@clusterserver1 ~]# vi /etc/my.cnf
[root@clusterserver1 ~]# vi /etc/my.cnf.d/client.cnf
[root@clusterserver1 ~]# systemctl restart mariadb
[root@clusterserver1 ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.44-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]> show variables like “%character%”;show variables like “%collation%”;
+————————–+—————————-+
| Variable_name            | Value                      |
+————————–+—————————-+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+————————–+—————————-+
8 rows in set (0.00 sec)

+———————-+—————–+
| Variable_name        | Value           |
+———————-+—————–+
| collation_connection | utf8_unicode_ci |
| collation_database   | utf8_unicode_ci |
| collation_server     | utf8_unicode_ci |
+———————-+—————–+
3 rows in set (0.00 sec)

MariaDB [(none)]>
MariaDB [(none)]> create user username@localhost identified by ‘password’;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on *.* to username@’%’ identified by ‘password’;
Query OK, 0 rows affected (0.00 sec)

Snapshot database in SQL Server

What is a database snapshot ?

Database snapshots are an Enterprise only feature which was introduced  in SQL Server 2005.A database snapshot is a view of what the source database looked like at the time when the
snapshot was created.

How does a snapshot work:-

a. When you create a snapshot a sparse file is created for each data file.
b.When data is modified in the source database for the first time, the old value of the modified data is copied to the sparse file.
c.If the same data is the subsequently changed again, those changes will be ignored and not copied to the snapshot.

How to create a snapshot?

USE master
GO
— Create a source Database
CREATE DATABASE sourcedb
GO
USE sourcedb
GO
— Populate sourcedb Database with some Table
CREATE TABLE Employee (ID INT, Value VARCHAR(10))
INSERT INTO Employee VALUES(1, ‘First’);
INSERT INTO Employee VALUES(2, ‘Second’);
INSERT INTO Employee VALUES(3, ‘Third’);
INSERT INTO Employee VALUES(4, ‘Fourth’);
GO
— Now Create Snapshot Database
CREATE DATABASE SnapshotDB ON
(Name =’sourcedb’,
FileName=’E:\snapshotdb.ss1′)
AS SNAPSHOT OF sourcedb;
GO
— Select from source and Snapshot Database
SELECT * FROM sourcedb.dbo.Employee;
SELECT * FROM SnapshotDB.dbo.Employee;
GO

ID Value
1 First
2 Second
3 Third
4 Fourth

ID Value
1 First
2 Second
3 Third
4 Fourth

Now lets do some dml activity on source db :-
— Delete from sourcedb Database
DELETE FROM sourcedb.dbo.employee;
GO

ID Value

ID Value
1 First
2 Second
3 Third
4 Fourth

So we can see the rows have been deleted from the sourcedb but the snapshot db is totally intact as it is.

Now, incase if we want to undo all the changes we did, we can revert back the database from the snapshotdb which was created before doing the activity.

— Restore Data from Snapshotdb Database
USE master
GO
RESTORE DATABASE sourcedb
FROM DATABASE_SNAPSHOT = ‘Snapshotdb’;
GO
— Select from sourcedb and Snapshotdb Database
SELECT * FROM sourcedb.dbo.employee;
SELECT * FROM Snapshotdb.dbo.employee;
GO

ID Value
1 First
2 Second
3 Third
4 Fourth

ID Value
1 First
2 Second
3 Third
4 Fourth

So we see all the datas are restored to the point when the snapshotdb was created.

Benefits of Database Snapshots:-

1.Snapshots can be used for reporting purposes.
2.Maintaining historical data for report generation.
3.Using a mirror database that you are maintaining for availability purposes to offload reporting.
4.In the event of a user error on a source database, you can revert the source database to the state it was in when a given database snapshot was created. For example, before doing
large dml activity, usually create a snapshot of the original db prior to the dml activity being done.

Reset SA Password in Sql Server 2012

Step 1:-
Change SQL SA password from a command prompt

Go to the command prompt of the server and type in command prompt osql –L
C:\Users\Administrator>osql -L

Servers:
localhost

Step 2:-
Copy full name of SQL Server and type: OSQL -S <insert_servername_here> -E
C:\Users\Administrator>osql -S localhost -E

Step 3:-
Execute the following query: sp_password NULL, ‘<insert_new_password_here>’, ‘sa’
1> sp_password NULL, ‘,pjam#’,’sa’
2> GO

Done, the sa password has been reset.

Recover database without control files and redolog files.

 Recover database without control files and redolog files.

Scenario:- We are deleting controlfiles from database and would recover database after dropping them.

Database version :- Oracle 11g R2
OS: Rhel 6
Database sid: orcl
Archivelog mode: enabled

Step1:-
$cd /u01/app/oracle/oradata/orcl
$rm -rf *.ctl

$sqlplus / as sysdba
SQL>startup
ORACLE instance started.

Total System Global Area  413372416 bytes
Fixed Size                  2213896 bytes
Variable Size             402655224 bytes
Database Buffers            4194304 bytes
Redo Buffers                4308992 bytes
ORA-00205: error in identifying control file, check alert log for more info

Step2:-Start the database in nomount stage
startup nomount
ORACLE instance started.

Total System Global Area  209715200 bytes
Fixed Size                  1248140 bytes
Variable Size              75498612 bytes
Database Buffers          130023424 bytes
Redo Buffers                2945024 bytes

Step3:-Recreate the control file:-

CREATE CONTROLFILE REUSE DATABASE “ORCL” RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ‘/u01/app/oracle/oradata/orcl/REDO01.log’  SIZE 50M,
GROUP 2 ‘/u01/app/oracle/oradata/orcl/REDO02.log’  SIZE 50M,
GROUP 3 ‘/u01/app/oracle/oradata/orcl/REDO03.log’  SIZE 50M
DATAFILE
‘/u01/app/oracle/oradata/orcl/system01.dbf’,
‘/u01/app/oracle/oradata/orcl/sysaux01.dbf’,
‘/u01/app/oracle/oradata/orcl/users01.dbf’,
‘/u01/app/oracle/oradata/orcl/example01.dbf’,
‘/u01/app/oracle/oradata/orcl/undotbs01.dbf’
CHARACTER SET WE8MSWIN1252;

Now after creating the control file, the database has been mounted.

Step 4.
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: ‘/u01/app/oracle/oradata/prim/system01.dbf’

So in this case we have to do the recovery  using the online redolog files.
SQL>  select * from v$log;

GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
———- ———- ———- ———- ———- ———- — —————- ————- ——— ———— ———
1          1          0   52428800        512          1 YES UNUSED                       0                      0
3          1          0   52428800        512          1 YES CURRENT                      0                      0
2          1          0   52428800        512          1 YES UNUSED                       0                      0

SQL> recover database until cancel using backup controlfile;
ORA-00279: change 1030644 generated at 01/08/2015 22:25:57 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/PRIM/archivelog/2015_01_08/o1_mf_1_1_%u_.arc
ORA-00280: change 1030644 for thread 1 is in sequence #1

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/flash_recovery_area/PRIM/archivelog/2015_01_08/o1_mf_1_1_%u_.arc
ORA-00308: cannot open archived log
‘/u01/app/oracle/flash_recovery_area/PRIM/archivelog/2015_01_08/o1_mf_1_1_%u_.ar
c’
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3

SQL> recover database until cancel using backup controlfile;
ORA-00279: change 1030644 generated at 01/08/2015 22:25:57 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/flash_recovery_area/PRIM/archivelog/2015_01_08/o1_mf_1_1_%u_.arc
ORA-00280: change 1030644 for thread 1 is in sequence #1
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/app/oracle/oradata/prim/REDO03.log
Log applied.
Media recovery complete.

SQL> alter database open resetlogs;

Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
——————–
READ WRITE

How to sync standby database which is lagging behind from primary database

How to sync standby database which is lagging behind from primary database
Primary Database cluster: cluster1.rmohan.com
Standby Database cluster: cluster2.rmohan.com

Primary Database: prim
Standby database: stand

Database version:11.2.0.1.0

Reason:-
1. Might be due to the network outage between the primary and the standby database leading to the archive
gaps. Data guard would be able to detect the archive gaps automatically and can fetch the missing logs as
soon as the connection is re-established.

2. It could also be due to archive logs getting missed out on the primary database or the archives getting
corrupted and there would be no valid backups.

In such cases where the standby lags far behind from the primary database, incremental backups can be used
as one of the  methods to roll forward the physical standby database to have it in sync with the primary database.

At primary database:-
SQL> select status,instance_name,database_role from v$database,v$instance;

STATUS       INSTANCE_NAME    DATABASE_ROLE
———— —————- —————-
OPEN         prim             PRIMARY

SQL> select thread#,max(sequence#) from v$archived_log group by thread#;

THREAD# MAX(SEQUENCE#)
———- ————–
1            214

At standby database:-
SQL> select status,instance_name,database_role from v$database,v$instance;

STATUS       INSTANCE_NAME    DATABASE_ROLE
———— —————- —————-
OPEN         stand            PHYSICAL STANDBY

SQL> select thread#,max(sequence#) from v$archived_log group by thread#;

THREAD# MAX(SEQUENCE#)
———- ————–
1             42
So we can see the standby database is having archive gap of around (214-42) 172 logs.

Step 1: Take a note of the Current SCN of the Physical Standby Database.
SQL> select current_scn from v$database;

CURRENT_SCN
———–
1022779

Step 2 : Cancel the Managed Recovery Process on the Standby database.
SQL> alter database recover managed standby database cancel;

Database altered.

Step 3: On the Primary database, take the incremental SCN backup from the SCN that is currently recorded on the standby database (1022779)
At primary database:-

RMAN> backup incremental from scn 1022779 database format ‘/tmp/rman_bkp/stnd_backp_%U.bak’;

Starting backup at 28-DEC-14

using channel ORA_DISK_1
backup will be obsolete on date 04-JAN-15
archived logs will not be kept or backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/prim/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/prim/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/prim/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/prim/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/prim/users01.dbf
channel ORA_DISK_1: starting piece 1 at 28-DEC-14
channel ORA_DISK_1: finished piece 1 at 28-DEC-14
piece handle=/tmp/rman_bkp/stnd_backp_0cpr8v08_1_1.bak tag=TAG20141228T025048 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25

using channel ORA_DISK_1
backup will be obsolete on date 04-JAN-15
archived logs will not be kept or backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 28-DEC-14
channel ORA_DISK_1: finished piece 1 at 28-DEC-14
piece handle=/tmp/rman_bkp/stnd_backp_0dpr8v12_1_1.bak tag=TAG20141228T025048 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 28-DEC-14

We took the backup inside /tmp/rman_bkp directory and ensure that it contains nothing besides the incremental backups of scn.

Step 4: Take the standby controlfile backup of the Primary database controlfile.

At primary database:

RMAN> backup current controlfile for standby format ‘/tmp/rman_bkp/stnd_%U.ctl’;

Starting backup at 28-DEC-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including standby control file in backup set
channel ORA_DISK_1: starting piece 1 at 28-DEC-14
channel ORA_DISK_1: finished piece 1 at 28-DEC-14
piece handle=/tmp/rman_bkp/stnd_0epr8v4e_1_1.ctl tag=TAG20141228T025301 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 28-DEC-14

Starting Control File and SPFILE Autobackup at 28-DEC-14
piece handle=/u01/app/oracle/flash_recovery_area/PRIM/autobackup/2014_12_28/o1_mf_s_867466384_b9y8sr8k_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 28-DEC-14

Step 5: Transfer the backups from the Primary cluster to the Standby cluster.
[oracle@cluster1 ~]$ cd /tmp/rman_bkp/
[oracle@cluster1 rman_bkp]$ ls -ltrh
total 24M
-rw-r—–. 1 oracle oinstall 4.2M Dec 28 02:51 stnd_backp_0cpr8v08_1_1.bak
-rw-r—–. 1 oracle oinstall 9.7M Dec 28 02:51 stnd_backp_0dpr8v12_1_1.bak
-rw-r—–. 1 oracle oinstall 9.7M Dec 28 02:53 stnd_0epr8v4e_1_1.ctl

oracle@cluster1 rman_bkp]$ scp *.* oracle@cluster2:/tmp/rman_bkp/
oracle@cluster2’s password:
stnd_0epr8v4e_1_1.ctl                                                                      100% 9856KB   9.6MB/s   00:00
stnd_backp_0cpr8v08_1_1.bak                                                                100% 4296KB   4.2MB/s   00:00
stnd_backp_0dpr8v12_1_1.bak                                                                100% 9856KB   9.6MB/s   00:00

Step 6: On the standby cluster, connect the Standby Database through RMAN and catalog the copied
incremental backups so that the Controlfile of the Standby Database would be aware of these
incremental backups.

At standby database:-

SQL>

[oracle@cluster2 ~]$ rman target /
RMAN> catalog start with ‘/tmp/rman_bkp’;

using target database control file instead of recovery catalog
searching for all files that match the pattern /tmp/rman_bkp

List of Files Unknown to the Database
=====================================
File Name: /tmp/rman_bkp/stnd_0epr8v4e_1_1.ctl
File Name: /tmp/rman_bkp/stnd_backp_0dpr8v12_1_1.bak
File Name: /tmp/rman_bkp/stnd_backp_0cpr8v08_1_1.bak

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files…
cataloging done

List of Cataloged Files
=======================
File Name: /tmp/rman_bkp/stnd_0epr8v4e_1_1.ctl
File Name: /tmp/rman_bkp/stnd_backp_0dpr8v12_1_1.bak
File Name: /tmp/rman_bkp/stnd_backp_0cpr8v08_1_1.bak

Step 7. Shutdown the database and open it in mount stage for recovery purpose.
SQL> shut immediate;
SQL> startup mount;

Step 8.Now recover the database :-
RMAN> rman target /
RMAN> recover database noredo;

Starting recover at 28-DEC-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=25 device type=DISK
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
destination for restore of datafile 00001: /u01/app/oracle/oradata/stand/system01.dbf
destination for restore of datafile 00002: /u01/app/oracle/oradata/stand/sysaux01.dbf
destination for restore of datafile 00003: /u01/app/oracle/oradata/stand/undotbs01.dbf
destination for restore of datafile 00004: /u01/app/oracle/oradata/stand/users01.dbf
destination for restore of datafile 00005: /u01/app/oracle/oradata/stand/example01.dbf
channel ORA_DISK_1: reading from backup piece /tmp/rman_bkp/stnd_backp_0cpr8v08_1_1.bak
channel ORA_DISK_1: piece handle=/tmp/rman_bkp/stnd_backp_0cpr8v08_1_1.bak tag=TAG20141228T025048
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03

Finished recover at 28-DEC-14
exit.

Step 9 : Shutdown the physical standby database, start it in nomount stage and restore the standby controlfile
backup that we had taken from the primary database.

SQL> shut immediate;
SQL> startup nomount;

[oracle@cluster2 rman_bkp]$ rman target /
RMAN> restore standby controlfile from ‘/tmp/rman_bkp/stnd_0epr8v4e_1_1.ctl’;
ecovery Manager: Release 11.2.0.1.0 – Production on Sun Dec 28 03:08:45 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PRIM (not mounted)

RMAN> restore standby controlfile from ‘/tmp/rman_bkp/stnd_0epr8v4e_1_1.ctl’;

Starting restore at 28-DEC-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/stand/stand.ctl
output file name=/u01/app/oracle/flash_recovery_area/stand/stand.ctl
Finished restore at 28-DEC-14

Step 10: Shutdown the standby database and mount the standby database, so that the standby database would
be mounted with the new controlfile that was restored in the previous step.

SQL> shut immediate;
SQL> startup mount;

At standby database:-
SQL> alter database recover managed standby database disconnect from session;

At primary database:-
SQL> select thread#,max(sequence#) from v$archived_log group by thread#;

THREAD# MAX(SEQUENCE#)
———- ————–
1            215

At standby database:-
SQL> select thread#,max(sequence#) from v$archived_log group by thread#;

THREAD# MAX(SEQUENCE#)
———- ————–
1            215

Step 11.Now we will cancel the recovery to open the database
SQL> alter database recover managed standby database cancel;

SQL> alter database open;
Database altered.

SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.

SQL> select open_mode from v$database;

OPEN_MODE
——————–
READ ONLY WITH APPLY

Now standby database is in sync with the Primary Database.

How to start/stop oracle database from linux command prompt

How to start/stop oracle database from linux command prompt

How to start/stop oracle database from linux command prompt:-
[oracle@configsrv1 ~]$vi /etc/oratab
#

# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ‘:’, is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, ‘#’, are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , “Y”, or should not,
# “N”, be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
prim:/u01/app/oracle/product/11.2.0/db_1:N

change the entry to this

prim:/u01/app/oracle/product/11.2.0/db_1:Y

and save the file.

For starting db
[oracle@configsrv1 ~] dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/product/11.2.0/db_1/bin/dbstart ORACLE_HOME
Processing Database instance “prim”: log file /u01/app/oracle/product/11.2.0/db_1/startup.log

To fix the above error;

[oracle@configsrv1 ~]export ORACLE_HOME_LISTNER=$ORACLE_HOME
[oracle@configsrv1 ~]dbstart $ORACLE_HOME
Then start the db again
[oracle@configsrv1 bin]$ dbstart $ORACLE_HOME
Processing Database instance “prim”: log file /u01/app/oracle/product/11.2.0/db_1/startup.log

For stopping db
[oracle@configsrv1 ~] dbshut

CentOS 7 used rpm install MySQL 5.7

$  wget http://repo.mysql.com/mysql57-community-release-el7-7.noarch.rpm

$ rpm -ivh mysql57-community-release-el7-7.noarch.rpm

[root@cluster1 ~]# rpm -ivh mysql57-community-release-el7-7.noarch.rpm
warning: mysql57-community-release-el7-7.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing…                ########################################### [100%]
1:mysql57-community-relea########################################### [100%]

$  yum install mysql-server

So far, mysql57 has been successfully installed. Now try to log on to use the root mysql, an error ERROR 1045 (28000): Access denied for user ‘root’ @ ‘localhost’

This problem occurs because the occurrence is estimated rpm mode after installing mysql default password used to initialize the root user.

After the degree of your mother get Google solution for 5.7.x version is invalid. The official website to find some ideas https://dev.mysql.com/doc/refman/5.7/en/server-management-using-systemd.html

mysql5.7.x version has some new changes, roughly

1.mysqld_safe has been abandoned, rpm installation package is not installed by default mysqld_safe

2.user table password column has been changed to authentication_string

After many tests and finally solve the root login issues. Resolve as follows

$  systemctl stop mysqld.service

$  systemctl set-environment MYSQLD_OPTS=”–user=mysql –skip-grant-tables –skip-networking”

$  systemctl start mysqld.service

$ mysql -u root mysql

mysql > UPDATE mysql.user SET authentication_string=PASSWORD(“mohan123”)  WHERE user=’root’ and host=’localhost’;

mysql > flush privileges;

mysql > quit

$  systemctl unset-environment MYSQLD_OPTS

$  systemctl restart mysqld.service

allow NFS access on Centos 7 and RHEL 7

Enable NFS server

  systemctl enable nfs-lock.service
  systemctl enable nfs-server.service

  systemctl start  nfs-lock.service
  systemctl start  nfs-server.service

  cat >/etc/firewalld/services/mountd.xml <<EOD
<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>mountd</short>
  <description>Mount Lock Daemon</description>
  <port protocol="tcp" port="20048"/>
  <port protocol="udp" port="20048"/>
</service>
EOD

  cat >/etc/firewalld/services/rpc-bind.xml <<EOD
<?xml version="1.0" encoding="utf-8"?>
<service>
  <short>rpc-bind</short>
  <description>Remote Procedure Call Bind</description>
  <port protocol="tcp" port="111"/>
  <port protocol="udp" port="111"/>
</service>
EOD

  restorecon /etc/firewalld/services

  firewall-cmd --permanent --zone public --add-service mountd
  firewall-cmd --permanent --zone public --add-service rpc-bind
  firewall-cmd --permanent --zone public --add-service nfs
  firewall-cmd --reload
  firewall-cmd --list-all