su – oracle
sqlplus /nolog
connect / as sysdba
show user
Once connected, you can change the SYS password to something you know:
ALTER USER sys IDENTIFIED BY new_password;
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
su – oracle sqlplus /nolog show user Once connected, you can change the SYS password to something you know:
CentOS 6.9 Docker public key rpm –import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org ELRepo rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm Cenos7? rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm (external link) kernel yum –enablerepo=elrepo-kernel install -y kernel-lt yum –enablerepo=elrepo-kernel install -y kernel-ml vi /etc/grub.conf default # grub.conf generated by anaconda docker ?1?selinux selinux LXCselinux vi /etc/selinux/config # This file controls the state of SELinux on the system. Fedora EPEL yum -y install http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm ?3?docker docker-io yum install -y docker-io ?4?docker service docker start ?5?docker docker version Client version: 1.7.1 docker hello-world hello-world docker pull hello-world hello-world docker run hello-world Hello from Docker. To generate this message, Docker took the following steps: To try something more ambitious, you can run an Ubuntu container with: For more examples and ideas, visit: yum list installed | grep docker yum -y remove docker-io.x86_64 rm -rf /var/lib/docker WebLogic Server 12c (12.1.1) http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html Installers with Oracle WebLogic Server and Oracle Coherence:?Generic (997 MB) wls1211_generic.jar java -jar wls1211_generic.jar java -jar wls1211_generic.jar -mode=console java -jar wls1211_generic.jar -log=D:\wlog\wsl_install.log Enter username to boot WebLogic server:weblogic home/weblogic_12c/user_projects/domains/base_domain/servers/AdminServer/security username=weblogic nohup ./startWebLogic.sh Install Gnome GUI on CentOS 7 / RHEL 7Linux admins spend most of their time on working in a terminal; there are some who like to work on GUI instead of a terminal. By default, CentOS 7 installed as the minimal server, and user intervention is required to change the installation type. This guide will help you to install GUI on CentOS 7 on the top of the minimal server installation. Before installing GUI, make a Local Yum Repository to avoid downloading packages from the internet. Optional: Run the following command to list down the available package groups for CentOS 7. # yum group list Output: Loaded plugins: fastestmirror There is no installed groups file. Maybe run: yum groups mark convert (see man yum) Loading mirror speeds from cached hostfile Available Environment Groups: Minimal Install Compute Node Infrastructure Server File and Print Server Basic Web Server Virtualization Host Server with GUI GNOME Desktop KDE Plasma Workspaces Development and Creative Workstation Available Groups: Compatibility Libraries Console Internet Tools Development Tools Graphical Administration Tools Legacy UNIX Compatibility Scientific Support Security Tools Smart Card Support System Administration Tools System Management Done Step 1: Install Gnome GUI using the YUM command. CentOS 7 # yum groupinstall "GNOME Desktop" "Graphical Administration Tools" RHEL 7 # yum groupinstall "Server with GUI" Step 2: Enable GUI on system startup. In CentOS 7, systemd uses “targets” instead of runlevel. The /etc/inittab file is no more used to change run levels. So, issue the following command to enable the GUI on system start. # ln -sf /lib/systemd/system/runlevel5.target /etc/systemd/system/default.target Step 3: Reboot the machine to start the server in the graphical mode. # reboot
open http://localhost
Performance Co-Pilot (PCP) on my RHEL server to capture performance logs
RHEL 7 (prior to RHEL 7.4)PCP is included in the base RHEL and Fedora distributions. A minimal installation requires just the pcp package (and its dependencies) to enable performance data logs to be collected for later analysis:
pcp pmstat pmatop pmcollectl At the moment Vector comes with the following list of widgets and dashboards that can be easily extended. Here is a short list of metrics available by default. CPU
Memory
Disk
Network
two solutions
A linux command to monitor the system process consuming resources on the server. If you are working on a linux system it is good to have at least basic understanding of this command. ps program or command when run take a snapshot of running processes at that time and display on the terminal which can be used to analyse the system performance or identify any problematic process which can be a risk for system. ps Command: $ ps PID TTY TIME CMD 22396 pts/0 00:00:00 su 22402 pts/0 00:00:00 bash 22417 pts/0 00:00:00 su 22420 pts/0 00:00:00 bash 23332 pts/0 00:00:00 ps PID – process id
TTY – terminal in which process is running TIME – total cpu time taken till now CMD – command Let’s try with one argument -f (full) $ ps -f this output is display with some more information – Let’s play with some argument and see what will be the output look like – $ ps -ef mohan 7585 1 0 18:29 ? 00:00:00 /usr/libexec/gvfsd-http –spawner :1.7 /org/gtk/gvfs/exec_spaw/2 All process $ ps aux Processes for User $ ps U <username> u $ ps U mohan u USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND Process tree $ ps afjx
Usually, when we are monitoring process, we are targeting something which can impact our server performance or some specific process. For doing so we grep the ps output – This is how we call list all http processes – $ ps aux | grep http atul 7585 0.0 0.0 177676 592 ? S Dec06 0:00 /usr/libexec/gvfsd-http --spawner :1.7 /org/gtk/gvfs/exec_spaw/2 root 28848 0.0 0.0 2700 168 pts/0 D+ 02:49 0:00 grep http you can filter ps command output by any keyword as above. There are some ps options which can give you a customized output – To see every process on the system using standard syntax: $ ps -e $ ps -ef $ ps -eF $ ps -ely To see every process on the system using BSD syntax:
$ ps ax $ ps axu To print a process tree: $ ps -ejH $ ps axjf To get info about threads: $ ps -eLf $ ps axms To get security info: $ ps -eo euser,ruser,suser,fuser,f,comm,lable $ ps axZ $ ps -eM To see every process running as root (real & effective ID) in user format: $ ps -U root -u root u To see every process with a user-defined format: $ ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm $ ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm $ ps -eopid,tt,user,fname,tmout,f,wchan Print only the process IDs of process syslogd: $ ps -C syslogd -o pid= #ps -C <process_name> -o pid= Print only the name of PID 42: $ ps -p 42 -o comm= #ps -p <process_id> -o comm= We can sort the ps command output by unix sort also which is easy to use. Need to pass ps command output to sort command with proper argument and Volla !! You will get the output as you want. Let’s see how this is work [ sort command arguement can differ per your linux flavour and version ] 1. Display the top CPU consuming process (Column 3 – %CPU) $ ps aux | head -1; ps aux | sort -k3 -nr |grep -v ‘USER’| head USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND mohan 21210 2.0 0.1 110232 1140 pts/3 R+ 00:13 0:00 ps aux For my linux sort command arguements are — sort -k3 -nr ==> sort the third column of output in numeric reverse sort (largest to smallest) 2. Display the top 10 memory consuming process (Column 4 – %MEM) $ ps aux | head -1; ps aux | sort -k4 -nr |grep -v ‘USER’| head USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 2204 0.1 4.3 147500 43872 tty1 Ss+ Aug22 0:46 /usr/bin/Xorg :0 -nr -verbose -audit 4 -auth /var/run/gdm/auth-for-gdm-wEmBs1/database -nolisten tcp vt1 3. Display the process by time (Column 4 – TIME) $ ps vx | head -1; ps vx | sort -k4 -r| grep -v ‘PID’ | head PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND 2478 ? Sl 1:52 351 593 447526 21876 2.1 /usr/lib/vmware-tools/sbin64/vmtoolsd -n vmusr –blockFd 3 4. Display the top 10 real memory usage process (Column 8 – RSS) $ ps vx | head -1; ps vx | sort -k8 -nr| grep -v ‘PID’ | head PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND Like above examples you can create so many one liners for you. But before using anyone of above one command, check your ps and sort command behavior then use them. Not because I really want to; but because I just don’t have the money to spend on a 2+ GB RAM VPS and I would like to run Jira. In order to do this I keep a close eye on the processes running and how much memory each takes. For this I found (and tweaked) the following bash command (originally found here):
This command will output every process and its memory usage in human readable (thus megabytes) format. For your convenience it is sorted by memory size descending (from highest to lowest). An example of its use:
(I am sure I can tune the above to use less memory; this is merely an example) I hope it will be as useful to you as it is to me, he Linux top command is used to show all the running processes within your Linux environment. This guide shows you how to use the top command by explaining the different switches available and the information that is displayed: How To Run The Top CommandIn its basic form all you need to do to show the current processes is type the following in a Linux terminal:
What Information Is Shown:The following information is displayed when you run the Linux top command: Line 1
The load average shows the system load time for the last 1, 5 and 15 minutes. Line 2
Line 3
This guide gives a definition of what CPU usage means. Line 3
Line 4
This guide gives a description of swap partitions and whether you need them. Main Table
Here is a good guide discussing computer memory. Keep Linux Top Running All The Time In The BackgroundYou can keep the top command easily available without having to type the word top each time into your terminal window. To pause top so that you can continue using the terminal, press CTRL and Z on the keyboard. To bring top back to the foreground, type fg. Key Switches For The Top Command:
Show The Current VersionType the following to show the current version details for top:
Output is in the form procps -ng version 3.3.10 Specify A Delay Time Between Screen RefreshesTo specify a delay between the screen refreshes whilst using top type the following:
To refresh every 5 seconds type top -d 5 Obtain A List Of Columns To Sort ByTo get a list of the columns with which you can sort the top command by type the following:
There are a lot of columns so you might wish to pipe the output to less as follows:
Sort The Columns In The Top Command By A Column NameUse the previous section to find a column to sort by and then use the following syntax to sort by that column:
To sort by %CPU type the following:
Only Show The Processes For A Specific UserTo show only the processes that a specific user is running use the following syntax:
For example to show all the processes that the user gary is running type the following:
Hide Idle TasksThe default top view can seem cluttered and if you want to see only active processes (i.e those that are not idle) then you can ran the top command using the following command:
Adding Extra Columns To The Top DisplayWhilst running top you can press the ‘F’ key which shows the list of fields that can be displayed in the table: Use the arrow keys to move up and down the list of fields. To set a field so that it is displayed on the screen press the ‘D’ key. To remove the field press “D” on it again. An asterisk (*) will appear next to displayed fields. You can set the field to sort the table by simply by pressing the “S” key on the field you wish to sort by. Press the enter key to commit your changes and press “Q” to quit. Toggling ModesWhilst running top you can press the “A” key to toggle between the standard display and an alternate display. Changing ColorsPress the “Z” key to change the colors of the values within top. There are three stages required to change the colors:
Press the “B” key to make text bold. Change The Display Whilst Running TopWhilst the top command is running you can toggle many of the features on and off by pressing relevant keys whilst it is running. The following table shows the key to press and the function it provides:
SummaryThere are more switches available and you can read more about them by typing the following into your terminal window: In December 2016 Microsoft made their SQL Server database available in Linux. Here we’ll cover how to install and perform basic setup of MSSQL in the RHEL based Linux distribution CentOS. Install MSSQL In CentOS 7First we’ll set up the repository file, Microsoft provide a copy of this for RHEL here: https://packages.microsoft.com/config/rhel/7/mssql-server.repo We’ll use the wget command to copy this file to the /etc/yum.repos.d/ directory so that we can use it with the yum or dnf package manager. [root@centos7 ~]# wget https://packages.microsoft.com/config/rhel/7/mssql-server.repo -O /etc/yum.repos.d/mssql-server.repo Now that the repository file is in place, installation is as simple as running the following command. At the time of writing the total size of the package was a 139mb download.
[root@centos7 ~]# yum install mssql-server -y ... +-------------------------------------------------------------------+ | Please run /opt/mssql/bin/sqlservr-setup to complete the setup of | | Microsoft(R) SQL Server(R). | +-------------------------------------------------------------------+ Once the installation has completed, we are advised to run the /opt/mssql/bin/sqlservr-setup bash script to complete the setup process. During my first installation attempt, I got the following error as my virtual machine was only running with 2GB of memory, so be sure that you have enough memory before proceeding. sqlservr: This program requires a machine with at least 3250 megabytes of memory. Microsoft(R) SQL Server(R) setup failed with error code 1. You’ll be able to proceed once you have adequate memory available. [root@centos7 ~]# /opt/mssql/bin/sqlservr-setup Microsoft(R) SQL Server(R) Setup You can abort setup at anytime by pressing Ctrl-C. Start this program with the --help option for information about running it in unattended mode. The license terms for this product can be downloaded from http://go.microsoft.com/fwlink/?LinkId=746388 and found in /usr/share/doc/mssql-server/LICENSE.TXT. Do you accept the license terms? If so, please type "YES": YES Please enter a password for the system administrator (SA) account: Please confirm the password for the system administrator (SA) account: Setting system administrator (SA) account password... Do you wish to start the SQL Server service now? [y/n]: y Do you wish to enable SQL Server to start on boot? [y/n]: y Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server.service to /usr/lib/systemd/system/mssql-server.service. Created symlink from /etc/systemd/system/multi-user.target.wants/mssql-server-telemetry.service to /usr/lib/systemd/system/mssql-server-telemetry.service. Setup completed successfully. That’s it, Microsoft SQL Server is now running successfully and listening for traffic on TCP port 1434. [root@centos7 ~]# systemctl status mssql-server â mssql-server.service - Microsoft(R) SQL Server(R) Database Engine Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2016-12-30 02:26:37 PST; 38s ago Main PID: 2974 (sqlservr) CGroup: /system.slice/mssql-server.service ââ2974 /opt/mssql/bin/sqlservr ââ2995 /opt/mssql/bin/sqlservr [root@centos7 ~]# netstat -antp | grep 1434 tcp 0 0 127.0.0.1:1434 0.0.0.0:* LISTEN 2995/sqlservr Connecting To MSSQLIn order to actually connect to the server from Linux we need to install the mssql-tools package, which comes from a different repository than the one that we just set up. It can be found here: https://packages.microsoft.com/config/rhel/7/prod.repo First we’ll download a copy of the prod.repo file and place it into the /etc/yum.repos.d/ directory. [root@centos7 ~]# wget https://packages.microsoft.com/config/rhel/7/prod.repo -O /etc/yum.repos.d/prod.repo We can now proceed with installing the mssql-tools package, as shown below. [root@centos7 ~]# yum install mssql-tools -y Once this is installed we can use the sqlcmd command to interact with the database. To see how to run sqlcmd, simply run it with the -? option for help. Unfortunately it appears that when you specify the -P option for the password, the password must be provided in the command line with no option of being prompted for it later. Keep in mind that your password will be stored in your bash history running it this way. [root@centos7 ~]# sqlcmd -U SA -P password 1> create database test; 2> go 1> use test; 2> go Changed database context to 'test'. 1> create table websites(domain varchar(255)); 2> go 1> insert into websites (domain) 2> values ('rootusers.com'); 3> go (1 rows affected) 1> select domain 2> from websites; 3> go domain rootusers.com (1 rows affected) In this example we create a test database with a table named websites and a column for domain names. We then insert a domain name and pull it back out with select, confirming both that we are able to connect and that basic SQL queries appear to be working as expected. SummaryMicrosoft’s SQL Server is now available for installation on Linux. Personally I don’t think I’ll ever use this over other alternatives such as MariaDB or PostgreSQL, so hopefully someone somewhere actually finds this information useful! |
|||||||||||||||||||||||||||||||||||||||||||||||||||||
Copyright © 2024 - All Rights Reserved Powered by WordPress & Atahualpa |
Recent Comments