Blue growth notes chase DBA (7): Basic commands, foundation stone

Source: Internet
Author: User
**************************************** ******************************** ************************************* Original works, this blog is from the "Deep Blue blog". You are welcome to repost it. Please indicate the source when you repost it. Otherwise, you will be held legally liable for copyright. Deep Blue blog: blog. c

**************************************** ******************************** ************************************* Original works, this blog is from the "Deep Blue blog". You are welcome to repost it. Please indicate the source when you repost it. Otherwise, you will be held legally liable for copyright. Deep Blue blog: http://blog.c

**************************************** ******************************** ***************************************

Original Works are from the blog of "Deep Blue blog". You are welcome to repost them. Please indicate the source when you repost them. Otherwise, the copyright will be held legally responsible.

Deep Blue blog: http://blog.csdn.net/huangyanlong/article/details/39738501

**************************************** **************************************** **************************************** ****

Blue growth note-Chase DBA (7): Basic commands, foundation stone

**************************************** ***************************** ***************************************

Personal Growth records on the oracle Road, expressed in blue, share the growing emotions, vision and technological changes and growth. Sensitive information is replaced by English and will not disclose any confidential information of the company. It is only used for technology sharing.

The creative inspiration comes from self-reflection and recording. I'm glad to have some help or resonance with the database friends who just started out.

Please leave a message or email (hyldba@163.com) indicating that the technical details are incorrect. Thank you very much.

**************************************** **************************************** **************************************** ***

The Foundation should be solid, so do not let small details affect professionalism.

-- Deep Blue

**************************************** ***************************** ***************************************

This is an accumulation of personal records. As we enter the blue ocean of oracle, we can't go all the way and continue to test. Share the growth history of blue with database friends.

I don't know when I began to become obsessed with blue. I was obsessed with its wide range, its depth, and its close proximity.

But it cannot be clear from when, watching the oracle red dazzling, illuminating a light in front of the eyes, unknown and confused under their own feet began to reveal some of the enrichment of life and the feedback of youth.

Step by step on the path to pursue DBA's dream.

**************************************** **************************************** **************************************** ***

Recently, when blue is dealing with problems and often following the troubleshooting process, it suddenly forgets the operation commands that should be played in seconds, and then looks at the relevant documents, which has a great impact on efficiency. Let's make a simple summary today. I don't know if my friends have used the following commands. Haha.

[Basic command version: V20141002]

Series 1. LINUX commands

View the system release version?

[root@hylhost ~]# cat /etc/issue | grep LinuxRed Hat Enterprise Linux Server release 5.5 (Tikanga) 

View system kernel information?

[root@hylhost ~]# uname -aLinux hylhost.domain.com 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux 

View System Kernel Parameter information?

# cat /etc/sysctl.conf

Supplement: After modifying the kernel parameters, run the sysctl-p command to make the kernel parameters take effect.

In general, how do I modify the oracle environment variables?

# su - oracle$ vi .bash_profile 

View the machine model?

[Root @ hylhost ~] # Dmidecode | grep "Product Name" Product Name: VirtualBox -- commands used to display the above information in the virtual machine environment

View Nic information?

[root@hylhost ~]# dmesg | grep -i ethe1000: eth0: e1000_probe: Intel(R) PRO/1000 Network ConnectionADDRCONF(NETDEV_UP): eth0: link is not readye1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RXADDRCONF(NETDEV_CHANGE): eth0: link becomes readyeth0: no IPv6 routers presente1000: eth0 NIC Link is Downe1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX 

View memory information?

[root@hylhost ~]# cat /proc/meminfoMemTotal:      2075468 kBMemFree:        935756 kBBuffers:        103892 kBCached:         877804 kBSwapCached:          0 kBActive:         340736 kBInactive:       735020 kBHighTotal:     1179584 kBHighFree:       198880 kBLowTotal:       895884 kBLowFree:        736876 kBSwapTotal:     4192956 kBSwapFree:      4192956 kBDirty:               8 kBWriteback:           0 kBAnonPages:       94088 kBMapped:          38204 kBSlab:            52624 kBPageTables:       3664 kBNFS_Unstable:        0 kBBounce:              0 kBCommitLimit:   5230688 kBCommitted_AS:   361940 kBVmallocTotal:   114680 kBVmallocUsed:      4716 kBVmallocChunk:   109848 kBHugePages_Total:     0HugePages_Free:      0HugePages_Rsvd:      0Hugepagesize:     4096 kB 

View Hard Disk Partitions?

[root@hylhost ~]# df -hFilesystem            Size  Used Avail Use% Mounted on/dev/sda3              25G  3.5G   21G  15% //dev/sda1             487M   16M  446M   4% /boottmpfs                1014M     0 1014M   0% /dev/shm 

View hard disk model?

[root@hylhost ~]# cat /proc/scsi/scsiAttached devices:Host: scsi0 Channel: 00 Id: 00 Lun: 00  Vendor: ATA      Model: VBOX HARDDISK    Rev: 1.0   Type:   Direct-Access                    ANSI SCSI revision: 05
How do I modify the IP address and host name?
1. address Resolution file # vi/etc/hosts2. Nic configuration file # vi/etc/sysconfig/network-scripts/ifcfg-eth0 where content points: Nic DEVICE name: DEVICE = eth0 is static: BOOTPROTO = staticIP address: IPADDR = 192.168.56.103 subnet mask: NETMASK = 255.255.255.0 hardware MAC address: HWADDR = 08: 00: 27: 29: DB: B2 whether to start: ONBOOT = yes3. network configuration file: # vi/etc/sysconfig/network where the content is: network Configuration: NETWORKING = yes disable ipv6 settings: NETWORKING_IPV6 = no host name: HOSTNAME = hyl

How do I create a group and a user?

# groupadd oinstall# groupadd dba# useradd -g oinstall -G dba oracle

How do I change the user password?

# passwd oracle 

How can I view uid and gid of a user?

# id oracle 

How to create an oracle user directory?

# mkdir -p /u01/app/oracle 

How do I modify the directory ownership?

# chown -R oracle:oinstall /home/u01/app 

How can I change the directory permissions?

# chmod -R 775 /home/u01/app 

How do I add a swap partition?

Generate an empty file: # dd if =/dev/zero of =/u01/swpf1 bs = 1024 k count = 2048 create a swap file: # mkswap-c/u01/swpf1 generate a swap file: # swapon/u01/swpf1 modify Automatic startup: # vi/etc/fstab Add/u01/swpf1 swap defaults 0 0

How to decompress various common packages?

(1)unzip decompress .cpio.gz format package # zcat unzip | cpio-idmv>/dev/null 2> & 1 (Example 2) decompress. cpio format package # cpio-idmv 

Delete?

Delete Directory: rm-rf
 <目录名>

 

Mount?

1. how to mount a CD: [root @ hyl soft] # df-hFilesystem Size Used Avail Use % Mounted on/dev/sr0 4.2G 4.2G 0 100%/media/CentOS_6.2_Final [root @ hyl soft] # mount/ dev/sr0/cdmount: block device/dev/sr0 is write-protected, mounting read-only2. how to mount an image file: [root @ hyl soft] # export WASND70_LINX64_Disk2.iso [root @ hyl soft] # mount-o loop/soft/WASND70_LINX64_Disk1.iso/cd1 [root @ hyl soft] # mount-o loop/soft/ WASND70_LINX64_Disk2.iso/cd2

Yum?

1. configure yum # cd/etc/yum. repos. d/modify yum. repo. Pay attention to the following details: baseurl = file: // cdrom1 // modify it to the Mount path gpgcheck = 0 // disable verification enabled = 1 // For details, refer: http://blog.csdn.net/huangyanlong/article/details/386149712> http://blog.csdn.net/huangyanlong/article/details/386149712> http://blog.csdn.net/huangyanlong/article/details/386149712. query the yum list # yum list3. yum installation package # yum install-y libaio *

What information does top follow get?

Part 1: 1. top: current time | system running duration | number of terminals | system load (1 minute ago, 5 minutes ago, 15 minutes ago) 2. tasks: Total number of system processes | Number of processes currently running | number of pending processes | Number of stopped processes | Number of recovered processes 3. cpu: cpu usage 4. mem: total memory | usage | idle memory | buffer memory usage 5. swap: wasp partition usage Part 2: Interactive Command Control Part 3: internal process usage list

Rpm?

1. Installation Package # rpm-ivh
 
  
2. Check whether the Installed Package [root @ hyl bin] # rpm-qa | grep numactlnumactl-devel-2.0.3-9.el6.x86_64numactl-2.0.3-9.el6.x86_643. Uninstall the Installed Package [root @ hyl ~] # Rpm-e numactl-devel-2.0.3-9.el6.x86_64 [root @ hyl ~] # Rpm e numactl-2.0.3-9.el6.x86_64
 
How to output the result to a log file?
For example, to write the installation package information to the rpm. log file, the command is: rpm-ivh binutils-2.17.50.0.6-14.el5.x86_64.rpm> rpm. log 2> & 1
Series 2: SQL commands

How to execute an SQL script?

SQL>@/soft/mkuser.sql 

Check which users are in the database?

SQL> select username,account_status from dba_users;USERNAME        ACCOUNT_STATUS--------------- -------------------------OUTLN           OPENSYS             OPENSYSTEM          OPENROSE            OPENSCOTT           OPENops$oracle      OPENTOM             OPENDBSNMP          EXPIRED & LOCKEDTSMSYS          EXPIRED & LOCKEDDIP             EXPIRED & LOCKED 

How to grant and revoke permissions to users

SQL> grant connect, resource to scott; SQL> grant select any table to scott with admin option; -- the user is not only authorized, but also can grant permissions to others SQL> grant INSERT, UPDATE, DELETE on scott. tcustord to ogg; -- Example: grant the insert, update, and delete permissions SQL> grant all on directory dir to public; -- directory permission (grant all permissions) SQL> revoke select any table from scott; -- When revoking permissions, you cannot cascade SQL> revoke INSERT, UPDATE, DELETE any table from ogg; -- Example

How can other users access the dba view?

Access dba view restrict SQL> show parameter o7SQL> alter system set O7_DICTIONARY_ACCESSIBILITY = true scope = spfile; -- change true to allow other users to access dba View

Tablespace?

SQL> create tablespace metro1 datafile '/u01/app/oradata/metroscore. dbf 'size 1000 mb; -- create a tablespace SQL> alter tablespace COMMON_PICTURE2012 drop datafile'/oracle/oradata/hyl3209/common_picture2012_02.dbf '; -- delete the data file SQL> alter tablespace COMMON_PICTURE2012 add DATAFILE '/oracle/oradata/hyl3209/COMMON_PICTURE2012_02.dbf' SIZE 3000 M REUSE AUTOEXTEND ON NEXT 1000 M MAXSIZE UNLIMITED; -- SQL> select tablespace_name, contents, status from dba_tablespaces; -- View table space status SQL> select name, bytes/1024/1024 M from v $ datafile; -- View table space size and data file size SQL> select tablespace_name, sum (bytes)/1024/1024 mb from dba_free_space group by tablespace_name; -- View SQL> select file_name, autoextensible, increment_by from dba_data_files; -- check whether the tablespace is automatically extended SQL> drop tablespace hyltablespace including contents and datafiles cascade constraints; -- delete tablespace SQL> drop user hyl cascade; -- delete users
Query temporary tablespace?
-- Dba_temp_files view, v _ $ tempfile view SQL> select file_id, file_name, tablespace_name from dba_temp_files; -- view the file and file number corresponding to the temporary tablespace SQL> select tablespace_name, file_name, bytes/1024/1024 file_size, autoextensible from dba_temp_files; SQL> select status, enabled, name, bytes/1024/1024 file_size from v _ $ tempfile; SQL> alter database tempfile '/u01/app/oracle/oradata/EMREP/temp01.dbf' drop; -- delete temporary tablespace SQL> create temporary tablespace tempts tempfile '/u01/app/oracle/oradata/EMREP/temp01.dbf' size 200 M autoextend on next 20 M maxsize unlimited; -- create temporary tablespace

Tablespace resizing

SQL> alter tablespace hyl add datafile '/u01/app/oracle/oradata/PROD/disk5/hyl. dbf 'size 2000 m; -- scale up hyl tablespace by about 2 GSQL> select tablespace_name, segment_space_management from user_tablespaces; -- view the tablespace segment management mode (whether it is auto scaling) SQL> alter database datafile '/u01/app/oracle/oradata/PROD/disk5/hyl. dbf 'autoextend on; -- enable auto Scaling

How to analyze tables?

SQL> analyze table emp3 estimate statistics; 

Complete registration immediately after configuring the listener?

SQL> ALTER SYSTEM REGISTER; 
Series 3. WAS Problems

How does one start WAS in Linux?

./StopServer. sh server1 path is generally under the profiles file path, for example, "/opt/IBM/WebSphere/AppServer/profiles/cmdrv01/bin ".

WAS optimization?

1. Connection Pool connection pool connections 2. Java Virtual Machine heap size settings (memory allocation) 3. Application site port number settings 4. Start servlet high-speed cache
Series 4. Oracle Problems

Oracle boot auto-Start Settings?

# Vi/etc/rc. d/rc. add the following example to local: su-oracle-c "/u01/app/oracle/product/11.2.0/db_1/bin/dbstart start" su-oracle-c "/u01/app/oracle/product/11.2.0 /db_1/bin/lsnrctl start"
# Change vi/etc/oratab to start xcky:/home/u01/app/oracle/product/11.2.0/db_1: Y

How does logical backup work?

Complex Export Statement: exp user/password @ service buffer = 128000 feedback = 10000 filesize = 15G file_format = D: \ large information table 20100101 _ % s. dmp TABLES = 'P table' query = \ "where create_datetime <= to_date ('000000', 'yyyymmdd') \" log = D: \ bak \ large information table 20100101. complex log import statement:> imp user/password @ service fromuser = user1 touser = user2 feedback = 10000 ignore = y commit = y filesize = 15G file = D: \ bak \ small table name of information. dmp log = D: \ bak \ small table name Imp. log
Series V. Operating System

How do I open the Windows registry?

Run and enter regedit.

How to quickly use remote connection?

mstsc。 

In the first stage, basic commands are summarized as memories.

Time Point: Thursday, January 1, October 2, 2014, in Beijing

There are no technical notes

After fatigue, I reflected on my thoughts and thought about it again, but I was confused about the future. Confused in the future, I don't know where to go, confused in the long wandering is not just the beginning, but found that the hands of oracle a little trembling, so in front of the road, bow down, feel the joy of oracle.

Blue, sometimes feel more and more sensitive, sometimes feel lonely wandering has no end, but all wake up in the same morning, let go of these limitations. Looking at yourself in the world, looking at the journey of the unknown, the challenges and ridicule around you, but in a flash, let yourself grow up again. Many times, I want to fade away the veil of disguise and smile as carefree as a child, but I find that to become a proud whale in the deep sea, I need to continue to explore the path of the whale group, you need to cheer up and swim to the blushing coast ......

In the blue world, I often say a word in my mouth, but I repeatedly repeat what is hard to comprehend. Sometimes I feel that in my own world, it does not seem as simple as I expected, your heart is far more complex than you expected. It is often in conflict. I want to start a new feeling, but after the left and right sides, I am afraid that I will not feel relieved again, and I will continue to torture my own heart. So I chose to ignore it and escape the pride and courage that I once boasted. I chose a peaceful person to wait for myself at night.

I don't know how long it will take, but blue always believes that one day, we will see the dawn of the horizon, reflecting the shadows of the shadows.

**************************************** ******************************** ***************************************

Original Works are from the blog of "Deep Blue blog". You are welcome to repost them. Please indicate the source when you repost them. Otherwise, the copyright will be held legally responsible.

Deep Blue blog: http://blog.csdn.net/huangyanlong/article/details/39738501

**************************************** **************************************** **************************************** ****

Series links:

Blue growth note-chasing DBA (1): traveling on the road to Shandong

Blue growth notes-Chase DBA (2): Install! Install! Long-lost memories have aroused my new awareness of DBAs.

Blue growth note-chasing DBA (3): importing and exporting data on antiques becomes a problem

Blue growth note-chasing DBA (4): recalling the sorrow of teenagers, and exploring oracle Installation (10g and 11g in Linux)

Blue growth note-chasing DBA (5): Not talking about technology or business, annoying Application Systems

Blue growth note-chasing DBA (6): doing things and being human: Small technology, great human

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.