What is a Database?

We already know that a database is a collection of data. And this data is stored in form of tables at logical level, and in the datafiles at the physical level. There are some other files as well like Redo log files, Control files, Initialization files which stores important information about the database.

What is an Instance?

To view or update data stored in tables/datafiles, Oracle must start a set of background processes, and must allocate some memory to be used during database operation. The background processes and memory allocated by Oracle together make up an Instance.


Oracle 12c For Dummies中关于DatabaseInstance二者之间关系的总结:

✓ An instance can exist without a database. Yes, it’s true. You can start an Oracle instance and not have it access any database files. Why would you do this?
• This is how you create a database. There’s no chicken-or-egg debate here. You first must start an Oracle instance; you create the database from within the instance.
• An Oracle feature called Automatic Storage Management uses an instance but isn’t associated with a database.
✓ A database can exist without an instance but would be useless. It’s just a bunch of magnetic blips on the hard drive.
✓ An instance can access only one database. When you start your instance, the next step is to mount that instance to a database. An instance can mount only one database at a time.
✓ You can set up multiple instances to access the same set of files or one database. Clustering is the basis for the Oracle Real Application Clusters feature. Many instances on several servers accessing one central data- base allows for scalability and high availability.


Oracle 12c For Dummies

database vs instances

Difference between Oracle Instance & Database.


Bash quoting简介

Bash quoting可以关闭Bash中具有特殊含义的meta字符的功能:
这样就可以理解为什么解压多个zip文件时,要使用“unzip '*.zip'”而不是“unzip *.zip”。因为第二种会首先把*.zip替换成所有的文件名,而第一种方法不会这样做。

How do I unzip multiple / many files under Linux?


Haskell笔记 (13)—— Algebraic data type

Algebraic data type可以拥有多个value constructor。比如Bool类型就是一种algebraic data type

data Bool = False | True

每个value constructor可以有0个或多个参数。

使用data关键字定义的数据类型,其实都是algebraic data type,只不过其只包含了一个value constructor


Linux kernel中针对shared memory有两个重要的配置项:shmmaxshmall

shmmax定义了一次分配shared memory的最大长度,单位是byte

# cat /proc/sys/kernel/shmmax

shmall定义了一共能分配shared memory的最大长度,单位是page

最大“shared memory” = shmall(cat /proc/sys/kernel/shmall) * pagesize(getconf PAGE_SIZE)



# sysctl -a | grep shmmax
kernel.shmmax = 18446744073692774399


# echo "536870912" > /proc/sys/kernel/shmmax
# sysctl -a | grep shmmax
kernel.shmmax = 536870912


# echo "kernel.shmmax = 536870912" >>  /etc/sysctl.conf
# sysctl -a | grep shmmax
kernel.shmmax = 18446744073692774399
# sysctl -p
kernel.shmmax = 536870912
# sysctl -a | grep shmmax
kernel.shmmax = 536870912


The Mysterious World of Shmmax and Shmall
Configuring SHMMAX and SHMALL for Oracle in Linux
What is shmmax, shmall, shmmni? Shared Memory Max


Haskell笔记 (12)—— 定义新的数据类型(data type)

使用data关键字来定义一种新的数据类型(data type):

data StudentInfo = Student Int String
                    deriving (Show)

StudentInfotype constructor,也是这种新type的名字,所以首字母必须大写。

Studentvalue constructor(有时也称之为data constructor)的名字,它的首字母也必须大写,作用是用来创建StudentInfo这种type的值。在Student后面的IntStringStudentInfo这种typecomponent,其作用类似于其它编程语言中结构体成员。

type constructor只用在type declarationtype signature中,而value constructor只用在实际的代码中。因此二者的使用是相互独立的,可以让type constructorvalue constructor拥有相同的名字,实际编码中基本也是这样做的:

data Student = Student Int String
                        deriving (Show)

也可以使用type关键字为已有的类型定义一个同义词(type synonym):

type SI = StudentInfo

type synonym也可以为一个冗长的类型取一个短名字,举例如下:

type SI = (Int, String)



class A {
    int member;

    member = 3;

如果没有提供构造函数,C++会自动生成一个不带参数的默认构造函数(即default constructordefault constructor可以是没有参数或所有参数都有默认值) ,这个默认构造函数会调用类成员的默认构造函数初始化所有成员,但不会初始化primitive typecharint等等)。一旦提供了一个构造函数,C++就不会提供默认的不带参数的构造函数了,这点一定要注意。

可以用initialization list方式初始化类的成员:

class A {
    void Output();
    int member;
    int haha;

A::A():member(3), haha(8)

只能使用initialization list初始化的成员:


Capture 当程序执行进入constructor代码时,整个object应该已经初始化完成了。 执行initialization list时,整个object还没有完全初始化完成。 因此constreference只能在initialization list中进行“初始化”,而不能在constructor中进行“赋值”。

Haskell笔记 (11)—— 函数的“type signature”

看一下take函数的type signature

ghci> :type take
take :: Int -> [a] -> [a]

这表明它有两个参数,返回值是一个list。“->”是右相关(right-associative),因此实际上也可以把take函数的type signature写成这样:

ghci> :type take
take :: Int -> ([a] -> [a])





NOTE: With Red Hat Subscription-Manager, registration and utilization of a subscription is actually a two-part process. First register a system, then apply a subscription.


# subscription-manager register --username <username> --password <password> --auto-attach

在我的RHEL 7.2系统上执行上述命令:

# subscription-manager register --username=xxxx --password=xxxx --auto-attach
Registering to:
The system has been registered with ID: 333486bb-xxxxxx

Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed


# subscription-manager list

    Installed Product Status
Product Name:   Red Hat Enterprise Linux Server
Product ID:     69
Version:        7.2
Arch:           x86_64
Status:         Subscribed
Status Details:
Starts:         06/29/2015
Ends:           06/28/2016

接下来就可以使用“yum install”,“yum update”等命令安装和更新软件了,非常方便。

How to Register and Enable Red Hat Subscription, Repositories and Updates for RHEL 7.0 Server
How to register and subscribe a system to the Red Hat Customer Portal using Red Hat Subscription-Manager
RHEL : Register Subscription